Unable to create UIBackgroundModes key in Info.plist for iOS4
Asked Answered
O

3

7

I have an audio application which works great for iPhone 3.1.x versions.

I am trying to upgrade it to iOS4.0 to work in multitasking environment. When I try to create a new UIBackgroundModes key in info.plist, it ("Required Background Modes") doesn't show up in drop down list?

I also upgraded the Xcode SDK to 3.2.3, Base SDK to 4.0, deployment target to 4.0 but still UIBackgroundModes ("Required Background Modes") won't show up in info.plist drop down list.

I also created test project for 4.0, and its info.list drop down list has "Required Background Modes".

Did I miss something?

Obeisance answered 15/7, 2010 at 1:17 Comment(0)
R
26

You can add the key manually by edit the .plist file

    <key>UIBackgroundModes</key>
    <array>
            <string>audio</string>
    </array>
Receptacle answered 15/7, 2010 at 2:36 Comment(5)
Thanks for your comment. I tried it but audio doesn't play in background after this. Moreover, key shows up "UIBackgroundModes" when viewing as XML property list, so I am guessing Xcode is not treating the project ready for 4.0.Obeisance
You need [to do more][1] to have audio playing in background. [1]: developer.apple.com/iphone/library/documentation/iphone/…Receptacle
It is an old thread though, still posting the resolution: Modify the .plist file manually with UIBackgroundMode tag. Although it won't show up in drop down list in xcode, but audio will play successfully in background mode.Obeisance
this won't work in the simulator, only on your deviceTheatricals
i would like to add "background fetch" in plist...What is the keyword for that please..Revolt
C
4

Be sure that if you create the UIBackgroundModes item in Xcode (not by editing the XML manually) that you create the new key as type ARRAY, then add a new item (it will appear as "Item 0" by default) with a value of "audio". If you simply create a string key with value "audio", it will not work.

Consuetudinary answered 24/8, 2010 at 15:48 Comment(0)
M
3

Re Woodmantech's answer: Xcode 3.2 changed the nomenclature a bit when adding this key in Xcode. The key is called "Required background modes" and Item 0 should be set to "App plays audio." Both are available through the GUI dropdown menu

Moriahmoriarty answered 25/5, 2011 at 23:15 Comment(1)
In Xcode 5 this key now seems to be called "App plays audio or streams audio/video using AirPlay"Jevon

© 2022 - 2024 — McMap. All rights reserved.