音量硬件按钮输入
我以前曾问过这个问题,但没有得到任何真正的答案。 iPhone 开发人员(例如 Camera+ 应用程序的开发人员)如何检测何时按下音量按钮以及如何防止系统音量变化。请不要仅仅链接到旧答案,除非它使用当前 App Store 安全的方式。如果有人知道,我们将不胜感激。谢谢你!
I have asked this question before, but have not received any real answer. How do iPhone developers, such as the developer of the Camera+ app, detect when the volume buttons are pressed and how do they prevent the system volume change. Please do not just link to an old answer unless it uses a way that is currently App Store safe. If anyone knows, help is greatly appreciated. Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
除了使用框架相机控件之外,没有 App Store 安全的方法可以做到这一点。当您使用标准控件时,您可以免费获得音量控件。如果您以其他方式进行审核,审阅者可能会也可能不会放您走,但除非您使用标准框架相机控件,否则正式您将被拒绝。
There is no App Store safe way to do it except to use the framework camera controls. When you use the standard controls, you get the volume controls for free. The reviewer may or may not let you go if you do it some other way, but officially you will be rejected unless you use the standard framework camera controls.
首先,请小心如何处理硬件输入,因为您知道如果处理不当,您将被应用商店拒绝
其次,阅读并学习 音频会话编程指南这将帮助您了解如何处理硬件输入,这里还有音频会话服务参考,它将在您对侦听器进行编程时为您提供帮助。
我无法为您提供特定于代码的解决方案,因为您没有详细说明将在何处以及何时使用它(在您的应用程序中)。此外,处理侦听器的位置也取决于您,因此我必须让您自行决定将侦听器放在哪里。
但苹果开发者库是一个很好的资源
First off, becareful how you handle Hardware inputs, as you know if handle them incorrectly, you will get rejected from the app store
Secondly, read and learn Audio Session Programmming Guide this will help you understand how to handle hardware inputs, also here is the Audio Session Services Reference that will help you when it comes to programming the the listeners.
I can't give you code specific solution because you didnt elaborate where and when this is going to be used (in your app). Also where you handle the listener is up to you, so i have to leave it to you to figure out where to put your listener.
But a good resource is the apple developer library