Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我使用 AVAudioPlayer 播放音乐让孩子们入睡。
当屏幕锁定或应用程序在后台时,音乐也会播放。如果播放时间过长,孩子们就会再次醒来。一位开发者朋友说 iOS 在后台暂停了预定的 NSTimer,所以它不可靠。
即使设备在后台,我还有什么其他选择可以让音乐在 30 分钟后停止?
You could take a look at these:
http://developer.apple.com/library/ios/DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html#//apple_ref/doc/uid/TP40007072-CH4-SW3
How to run the timer in background of the application?