Unity iOS Build Problem: Corrupted Info.plist

Unity iOS Build Problem: Corrupted Info.plist

I ran into a strange problem under Unity iOS: The generated Xcode project often but not always reported a corrupted Info.plist. And of course Info.plist was not readable at all. Here is what I found out.

Using version 4.3.4f1 I ran into trouble when bulding the iOS player in Append mode. The problem is related to modifications in Info.plist. Everything works as expected at the first run, in replace mode or if you deleted the Info.plist. But if you choose append mode on building, Xcode might show the following error:

The data couldn’t be read because it has been corrupted.

Some people reported in the Unity Forum thread Corrupted Info.plist file that this is related to an ampersand in the display title. Others said the problem arises only when Default Orientation is set to Auto Rotation. I have no ampersand in the title and I was not able to reproduce the orientation thing i.e. my project works fine with an empty value for key UIInterfaceOrientation (=Initial interface orientation).

In my case the problem was related to post build modification of Info.plist. I had a build pre-action in Xcode defined to add some keys to info-plist:


The same error showed up when I move all shell commands from my script modify_info_plist.sh like defaults write … to the PostProcessbuildPlayer script. Definitely a bug in 4.3.4.

I found out that if Info.plist is modified manually in Xcode everything is working fine and you can use append mode without any problems. But subsequent builds fail if Info.plist is modified by a with shell command

defaults write $mydomain UIRequiredDeviceCapabilities -array-add  „gyroscope“

Looking at Xcode’s version editor reveals a slightly different DOCTYPE definition although the link to the DTD is the same.

Solution 1: Manual Info.plist Modifications

So if your modifications to Info.plist are not too complex or are not influenced dynamically, the solution is to do them manually and remove all code that manipulates Info.plist using defaults write.

Solution 2: Using A Build Pipeline

As mentioned above deleting Info.plist before starting the build works with no problems. Inspired by this Unity forum post I tried out if the problem persists when using a custom build pipeline that deletes Info.plist as first step of the build process. It worked!  I put the following code in a static editor class to create a new menu item Tools / My iOS Build:


Update: Bug Report

I reported a bug at Unity (case 599862) including an empty project to reproduce it, let’s see what happens.


Comments are closed.

Post navigation

Previous Post :   

Durch die weitere Nutzung der Webseite stimmen Sie der Verwendung von Cookies zu Mehr
By continuing to use the site, you agree to the use of cookies. More

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.