• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

iOS的后台录音

用户头像
it1352
帮助1

问题说明

我已经广泛搜索了有关如何在后台录制音频的文档,并得出结论,在 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.

正确答案

#1

除了在 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
系列文章
更多 icon
同类精品
更多 icon
继续加载