Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Is there a way to change the volume of the device? I've seen several apps do it.

I have a desktop version of the iOS app and the device will be able to be controlled to some extent over the network. One of the things I want to allow the user to do is change the device volume and then play a sound. This can help if you loose your iPhone in a crack in your couch again, but can't find it.

Is there any way that you can do this without Apple getting angry?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
380 views
Welcome To Ask or Share your Answers For Others

1 Answer

Using iPodMusicPlayer would affect the actual iPod volume setting as well. If you want to avoid that, use this:

#import <MediaPlayer/MediaPlayer.h>
// ...
MPMusicPlayerController *musicPlayer = [MPMusicPlayerController applicationMusicPlayer];
musicPlayer.volume = 1.0f; 

As the user holex correctly mentioned the property volume in MPMusicPlayerController is deprecated in iOS 7.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...