Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to populate different Info.plists for different configurations in Xcode

I need to populate different Info.plists for iOS Device & Simulator schemes for the same target. How do I achieve it? The problem is as following: My application is voip therefore I need to add a UIBackgroundModes to Info.plist, but the problem is that when this property exists in the plist and I run the Simulator scheme, Simulator just stuck on the splash screen and I even pressing Home button doesn't do anything, Console doesn't show anything either. So I'd like to have one plist for Simulator scheme w/o UIBackgroundModes property and the second - with. I could do it with a shell script, but since the script is same for both schemes I don't know how to distinguish between them...

TIA

like image 474
Nava Carmon Avatar asked Feb 26 '23 13:02

Nava Carmon


2 Answers

Another solution:

In Xcode 4.3 (and possibly earlier) you can use preprocessor defines in your Info.plist. So you can for example set your UIBackgroundModes to ${MY_BACKGROUNDMODES}

In your build settings you can then define different MY_BACKGROUNDMODES values per build configuration.

like image 92
Stefan Arentz Avatar answered Feb 28 '23 02:02

Stefan Arentz


In the project view. If you click on the any given group folder a table listing appears in the top half of the split of its contents.

The rightmost column is a tick box which tells you whether the item is included in the target. Clone out your debug target config and the plist. Include one plist in your simulation config and the other in your device config.

like image 35
Warren Burton Avatar answered Feb 28 '23 04:02

Warren Burton