Search Unity

Corrupted info.plist file

Discussion in 'iOS and tvOS' started by Nephilim, Apr 9, 2012.

  1. Nephilim

    Nephilim

    Joined:
    Aug 11, 2011
    Posts:
    10
    I just encountered an issue that I thought I would document the solution of here in case others run into it.

    When exporting to iOS, I was getting a message in Xcode saying "The data couldn’t be read because it has been corrupted." referring to the info.plist file.

    The problem was that I had used an ampersand in the display title for my game. Since the ampersand is an escape character, this caused problems when Xcode tried to parse the Info.plist file.

    Changing the ampersand to "and" fixed the problem - you can do it either in the Unity IDE or in the Info.plist file directly using a text editor. (The problem could also occur if the filenames for icon files have ampersands in them, presumably.)

    Hope this saves someone some hair pulling.
     
  2. Filax

    Filax

    Guest

    Joined:
    Mar 30, 2011
    Posts:
    8
    For this tips !!
     
  3. Robota

    Robota

    Joined:
    Feb 7, 2012
    Posts:
    82
    Yes thank you!
     
  4. matthowarth

    matthowarth

    Joined:
    Jul 18, 2012
    Posts:
    7
    you did indeed save a great deal of lost hair, many thanks!

    Matt
     
  5. JakobHAndersen

    JakobHAndersen

    Joined:
    Oct 8, 2012
    Posts:
    5
    Thanks a lot :)
     
  6. GameDev_India

    GameDev_India

    Joined:
    Nov 4, 2012
    Posts:
    88
    thanks a lot !!
     
  7. thempus

    thempus

    Joined:
    Jul 3, 2010
    Posts:
    61
    Thanks a lot haha!
     
  8. disturbing

    disturbing

    Joined:
    Dec 12, 2010
    Posts:
    127
    Woohoo, saving hair for over one year :)
     
  9. Jason-King

    Jason-King

    Joined:
    Oct 28, 2010
    Posts:
    56
    Another reason for the corruption...

    When building for iOS, the Info.plist is being corrupted whenever Default Orientation is set to Auto Rotation. The Info.plist file is created properly on the first build, but subsequent builds results in...

    <key>UIInterfaceOrientation</key>
    <string></string>
    </string>

    ... at this point Xcode fails to build the project.
     
  10. smktang

    smktang

    Joined:
    May 15, 2013
    Posts:
    6
    I can confirm this behavior - and I thought I was the only one who 's been experiencing this. I have the plist file open in a text editor permanently to manually remove that extra tag.
     
  11. KevinCodes4Food

    KevinCodes4Food

    Joined:
    Dec 6, 2013
    Posts:
    61
    Thank you, Nephilim - another head of hair saved!
     
  12. tiz777

    tiz777

    Joined:
    Jan 20, 2010
    Posts:
    93
    Your tips was really appreciated :) thank you very much!
     
  13. Ryuuguu

    Ryuuguu

    Joined:
    Apr 14, 2007
    Posts:
    391
    THis tip is better than the energisor bunny. 2 years later and still keeps saving people including me.
     
  14. MoribitoMT

    MoribitoMT

    Joined:
    Jun 1, 2013
    Posts:
    301
    God bless thread owner, solved my problem :eek:
     
  15. CTRLconsole

    CTRLconsole

    Joined:
    Jan 9, 2013
    Posts:
    19
    Thank you! It's the gift that keeps on giving! Solved my problem too. :)
     
  16. JonnyHilly

    JonnyHilly

    Joined:
    Sep 4, 2009
    Posts:
    749
    Saved me too !!! you'd think they would make an appropriate error message.... "invalid characters used in App Name, use alphanumeric only"
     
  17. Agent_007

    Agent_007

    Joined:
    Dec 18, 2011
    Posts:
    899
    We are talking about Apple here...
     
  18. jperr

    jperr

    Joined:
    Jun 3, 2014
    Posts:
    1
    I am experiencing this exact issue in Unity 4.3.4f1 when using the "Build and Run" function for iOS. Has this been solved or reported as a bug to the Unity team?
     
  19. Smilediver

    Smilediver

    Joined:
    May 5, 2011
    Posts:
    72
  20. ObviousDWest

    ObviousDWest

    Joined:
    May 20, 2013
    Posts:
    5
    I am still seeing this in 4.5.1f3. It occurs when using the Facebook plugin (version 6.0), which adds an odd property block to info.plist (pasted below), while leaving default orientation set to autorotate:
    <key>CFBundleURLTypes</key>
    <array>
    <dict>
    <key>CFBundleURLSchemes</key>
    <array>
    <string>fbYOUR_APP_ID</string>
    </array>
    </dict>
    </array>

    Using append builds, on the second time through, it causes the orientation field to show up as:
    <key>UIInterfaceOrientation</key>
    <string></string>
    </string>
     
  21. ObviousDWest

    ObviousDWest

    Joined:
    May 20, 2013
    Posts:
    5
    The more direct cause of this is that a newline is added within the string field due to system.XmlDocument being used to read and rewrite info.plist. If the input file looks like this (which seems ok):
    <key>UIInterfaceOrientation</key>
    <string>
    </string>
    ...then an append build will make it look like this (which is broken):
    <key>UIInterfaceOrientation</key>
    <string></string>
    </string>
     
  22. ObviousDWest

    ObviousDWest

    Joined:
    May 20, 2013
    Posts:
    5
    I found a fix (related to this post http://forum.unity3d.com/threads/facebook-sdk-for-unity-plist-fix.217876/), to be added to PlistMod.cs. I didn't take all of the suggestions in that post. What this does is add a space to the empty string. That seems to keep system.XmlDocument from splitting the line, and the next append build stops blowing up.

    //Strip whitespace from empty strings
    Regex nonwhite = new Regex("\\S");
    XmlNodeList elemList = doc.GetElementsByTagName("string");
    for (int i = 0; i < elemList.Count; i++)
    {
    if (!nonwhite.IsMatch(elemList.InnerText))
    {
    // Replace with something that keeps formatter from splitting the line.
    elemList.InnerText = " ";
    }
    }

    doc.Save(fullPath);
     
  23. cheywood

    cheywood

    Joined:
    Dec 10, 2013
    Posts:
    10
    I'm now seeing this with 4.6.0, while I didn't have it with 4.5.5.