我正在开发一款定制 iPhone 闹钟。
一些用户在设备处于静音和锁定状态时睡过觉。
我知道,如果应用程序在用户锁定设备之前位于前台,则顶级 iPhone 闹钟(“智能闹钟免费”、“生命地球”、“升起”)可以手动控制和增加音量。
有人知道如何在静音模式下导航吗?
最佳答案
配置 audio session 时只需使用 AVAudioSessionCategoryPlayback
类别即可。来自文档:
AVAudioSessionCategoryPlayback or the equivalent kAudioSessionCategory_MediaPlayback—Use this category for an application whose audio playback is of primary importance. Your audio plays even with the screen locked and with the Ring/Silent switch set to silent.
有关不同 Audio Session 类别以及如何设置它们的详细信息,请参阅 here .
关于iPhone 闹钟渐进式音乐提醒 + 音量控制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15485819/