iOS的后台录音
问题说明
我已经广泛搜索了有关如何在后台录制音频的文档,并得出结论,在 plist 文件中指定音频"可能有效.但是,因为 iOS 4 会在内存不足时终止后台应用程序,所以我们还必须采取一些措施来减少过渡到后台时的内存使用量.我们如何减少内存使用量?
I have searched far and wide for documentation on how to record audio in the background and have come to the conclusion that specifying 'audio' in the plist file might work. But, because iOS 4 will terminate background apps when it runs low on memory, we must also take some steps to reduce our memory usage when we transition to the background. How do we reduce our memory usage?
另外,有谁知道在 iOS 后台录制音频的可靠方法吗??
Also, does anybody know a sure shot way of recording audio in the background on iOS??
我取消选中 Info.plist 文件中显示应用程序不在后台运行"的框,并添加了
I unchecked the box in the Info.plist file that says "Application does not run in background" and also added the
<key> UIBackgroundModes </ key> < array> < string> audio</ string></ array>
在 Info.plist
中.但是,只要我按下HOME"按钮,录音就会停止.
in Info.plist
. But, the recording stops as soon as I press the "HOME" button.
我们实现了什么回调来知道应用程序已经进入后台?请指教.
What callbacks do we implement to know that application has gone to background? Please advise.
正确答案
除了在 plist 文件中指定后台录制外,我们还可以实现 applicationDidEnterBackground ,它会告诉我们应用程序何时进入后台.在这里,我们应该停止对 UI 的任何更新,因为这会消耗内存,例如更新计时器和均衡器.
Apart from specifying background recording in the plist file, we can implement applicationDidEnterBackground wihch will tell us when the application enters background. Here, we should stop any updates to the UI because that consumes memory for eg, updating a timer and an equalizer.
调用 applicationWillEnterForeground 将在应用程序返回前台之前被调用,因此我们可以继续我们停止的任何内容.
The call applicationWillEnterForeground will be called just before the app returns to foreground so we can resume whatever we stopped.
然后录制会在后台进行.实现一个中断监听器也有帮助(这也可以在后台工作),这样你就不会丢失你的录音.
The recording then takes place in the background. It would also help to implement an interruption listener(this would work in the backgroud as well) so that you don't lose your recordings.
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcgbkce
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
希伯来语的空格句子标记化错误
it1352 06-22 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20