How to programmatically silence the ringer or change the ringer tone on iOS5

和自甴很熟 提交于 2019-11-28 01:12:35

问题


Is there a way to reduce the volume of the ringer or change the ringer tone on iOS5?

I checked out the Celestial framework, but can't instantiate AVSystemController. :-(

I don't care if this get's the app rejected in the AppStore as it will never be submitted.


回答1:


Yes. Use AVSystemController. You don't instantiate it. It's a singleton.

http://code.google.com/p/iphone-dev/source/browse/trunk/include/include/Celestial/AVSystemController.h?r=136

[[AVSystemController sharedAVSystemController] setVolumeTo:10.0 forCategory:@"Ringtone"];



回答2:


This might be what you are looking for: Override ringer volume in iPhone apps

Basically, you set the volume using AVAudioPlayer on the -(void)viewDidLoad method of the view you are displaying on



来源:https://stackoverflow.com/questions/9320725/how-to-programmatically-silence-the-ringer-or-change-the-ringer-tone-on-ios5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!