Detect Silent mode in iOS5?

后端 未结 2 858
情书的邮戳
情书的邮戳 2020-11-28 11:30

I have used this method in the past to detect if the silent switch is enabled:

- (BOOL)silenced {
    #if TARGET_IPHONE_SIMULATOR
    // return NO in simulat         


        
2条回答
  •  鱼传尺愫
    2020-11-28 11:56

    As mentioned in the iOS Developer Library, the property kAudioSessionProperty_AudioRoute is deprecated. Instead, Use the kAudioSessionProperty_AudioRouteDescription

    https://developer.apple.com/library/ios/#documentation/AudioToolbox/Reference/AudioSessionServicesReference/Reference/reference.html

    This question has been answered here: Detecting the iPhone's Ring / Silent / Mute switch using AVAudioPlayer not working?

提交回复
热议问题