在iOS的后台录音 [英] background audio recording in iOS

查看:654
本文介绍了在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 。不过,该记录将立即停止,因为我preSS的主页按钮。

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当应用程序进入后台wihch会告诉我们。在这里,我们应该停止任何更新用户界面,因为这对如消耗内存,更新计时器和均衡器。

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.

这篇关于在iOS的后台录音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆