AIR for iOS 实现后台播放音乐

本文转载自badyo的博客,地址www.badyoo.com/index.php/2012/05/29/121/index.html

在air for ios开发中,如何实现在应用程序最小化后,任然播放音乐呢?我们只要在配置文件里找到以下代码。

<iPhone>
<InfoAdditions><![CDATA[
<key>UIDeviceFamily</key>
<array>
<string>1</string>
<string>2</string>
</array>
]]></InfoAdditions>
<requestedDisplayResolution>high</requestedDisplayResolution>
</iPhone>
在其中加上
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
最后该代码变成:
<iPhone>
<InfoAdditions><![CDATA[
<key>UIDeviceFamily</key>
<array>
<string>1</string>
<string>2</string>
</array>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
]]></InfoAdditions>
<requestedDisplayResolution>high</requestedDisplayResolution>
</iPhone>