iOS Detect system volume level change. private API or not? AVSystemController_SystemVolumeDidChangeNotification

不想你离开。 提交于 2019-12-05 20:51:40

问题


Can listening to AVSystemController_SystemVolumeDidChangeNotification NSNotification be considered (during the App Store review process) as using private API?

In my application I need to display and update the current volume level. Volume indicator should be updated after pressing hardware volume buttons and after volume change in MPVolumeView slider.

I've searched solution how to get notification or event of hardware volume button press and had found a number of solutions.

For example, iPhone Detect Volume Keys press.

and

How to get audio volume level, and volume changed notifications on iOS?

I like the solution with listening to NSNotificationCenter and it seems that the most simplest and clear solution is listening to AVSystemController_SystemVolumeDidChangeNotification (And it works fine)

But there are one important thing that I want to know for sure.

This notification name is not appearing in any official Apple documentation, and there are discussions about if this notification usage will be considered as "Using the private API" or not.

As I understand, using the private API is connected with calling private methods. Thats why using this notification key can not be considered as private API usage (because actually we are using notification name as NSString).

Maybe somebody knows this for sure, or have experience with usage of the AVSystemController_SystemVolumeDidChangeNotification and app was submitted/rejected?

Many thanks for any information!


回答1:


I know an alternative method using KVO has been mentioned in the comments. The limitations of this method are also discussed in the comments. The original question though was about experience of using the NSNotificationCenter and AVSystemController_SystemVolumeDidChangeNotification. I have used this method in my app and it didn't get rejected. It is available on the AppStore.



来源:https://stackoverflow.com/questions/25308589/ios-detect-system-volume-level-change-private-api-or-not-avsystemcontroller-sy

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