iOS 检测系统音量级别变化.私有API与否?AVSystemController_SystemVolumeDidChangeNotification [英] iOS Detect system volume level change. private API or not? AVSystemController_SystemVolumeDidChangeNotification

查看:35
本文介绍了iOS 检测系统音量级别变化.私有API与否?AVSystemController_SystemVolumeDidChangeNotification的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将 AVSystemController_SystemVolumeDidChangeNotification NSNotification 的监听(在 App Store 审核过程中)视为使用私有 API?

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

在我的应用程序中,我需要显示和更新当前音量级别.按下硬件音量按钮和 MPVolumeView 滑块中的音量变化后,音量指示器应更新.

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.

例如,iPhone 检测音量键按下.

如何获得iOS 上的音频音量级别和音量更改通知?

我喜欢听 NSNotificationCenter 的解决方案,似乎最简单明了的解决方案是听 AVSystemController_SystemVolumeDidChangeNotification(而且效果很好)

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.

此通知名称未出现在任何 Apple 官方文档中,并且有关于此通知用法是否会被视为使用私有 API"的讨论.

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.

据我所知,使用私有 API 与调用私有方法有关.这就是为什么使用这个通知键不能被视为私有 API 使用(因为实际上我们使用通知名称作为 NSString).

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).

也许有人肯定知道这一点,或者有使用 AVSystemController_SystemVolumeDidChangeNotification 和应用程序被提交/拒绝的经验?

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!

推荐答案

我知道评论中提到了使用 KVO 的替代方法.评论中还讨论了此方法的局限性.最初的问题是关于使用 NSNotificationCenterAVSystemController_SystemVolumeDidChangeNotification 的体验.我在我的应用程序中使用了这种方法并且它没有被拒绝.它可以在 App Store 上找到.

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 the 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 App Store.

这篇关于iOS 检测系统音量级别变化.私有API与否?AVSystemController_SystemVolumeDidChangeNotification的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆