Alternative to deprecated AudioSessionGetProperty, for iOS 7

别来无恙 提交于 2019-11-29 06:14:27

问题


I am using AudioSessionGetProperty to check 'audioIsAlreadyPlaying'. Xcode says: 'AudioSessionGetProperty' is deprecated: first deprecated in iOS 7.0

Please could someone tell me what I should use instead, to get the audioIsAlreadyPlaying property.

AudioSessionGetProperty(kAudioSessionProperty_OtherAudioIsPlaying,
                        &propertySize,
                        &audioIsAlreadyPlaying);
return audioIsAlreadyPlaying;

回答1:


Trying using the AVAudioSession's otherAudioPlaying property on iOS 6.0 or higher.

[[AVAudioSession sharedInstance] isOtherAudioPlaying]




回答2:


The AVAudioSession class replaces deprecated AudioSession APIs. For what you're doing, see the otherAudioPlaying property.



来源:https://stackoverflow.com/questions/18945931/alternative-to-deprecated-audiosessiongetproperty-for-ios-7

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