add new bool item to info.plist with UnityEditor.iOS.Xcode
I used this example: http://forum.unity3d.com/threads/how-can-you-add-items-to-the-xcode-project-targets-info-plist-using-the-xcodeapi.330574/
To successfully add a new element array to info.plist when building to iOS. Hurrah.
I want to now add a bool element to the info.plist but I can not figure it out. I wish the unity documentation had examples.
Here's my failed attempt, how can I fix it? I get all kinds of type conversion errors
// WORKING:
// Get plist
string plistPath = pathToBuiltProject + "/Info.plist";
PlistDocument plist = new PlistDocument();
plist.ReadFromString(File.ReadAllText(plistPath));
// Get root
PlistElementDict rootDict = plist.root;
// NOT WORKING:
// add iTunes write to file permissions
PlistElementBoolean iTunesFileSupport = rootDict.CreateArray("Application supports iTunes file sharing");
iTunesFileSupport.AsBoolean(true);
Answer by fagtr0n · Jul 25, 2016 at 03:45 PM
It's literally this:
// Enable iTunes file sharing
rootDict.SetBoolean ("UIFileSharingEnabled", true);
In the case of the array of items, like in supported external devices, a new array must be created and new string added. But in this case, all I had to do was use the set boolean function, the key of "Application supports iTunes file sharing" which is "UIFileSharingEnabled" and set it to true.
heres a reference for iOS info.plist keys: https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW1
Your answer
Follow this Question
Related Questions
Monetization breaks iOS build in XCode. Also breaks Android build. 1 Answer
Xcode 7.2/Unity Linker command error exit code 1 1 Answer
iOS build - XCode set to Automatically manage signing 1 Answer
Xcode stuck / hangs when compiling source files for Unity project 5 Answers
iOs build fails on 5.3 1 Answer