1
votes

My app started crashing mysteriously today, when running via Xcode. I tracked the problem to the settings not being available, and in fact, looking at the settings app for my app, I see:

enter image description here

Going to my Settings.bundle in Xcode, specifically Root.plist, I get this error message:

enter image description here

So, the file has been corrupted. Disturbing, but not too worrisome. I get a copy of the file from last night (thanks TimeMachine). I do a diff between that file and the one I have now, and I see no difference. I go back a few days until I find a version that is different. Unfortunately that was when I seriously revamped the root.plist file, so I can't find anything corrupted in the latest version.

Also, the app only crashes on a new iPhone where my app was never installed before. My other iPhones don't crash when running the same app via Xcode, but all show an empty Settings window as in the screenshot above. I think that maybe despite the corrupted root.plist, the actual NSUSerDefaults are still on the iPhones that at one point had a non-corrupt root.plist, but on the new iPhone there is no NSUSerDefaults, which leads to some bad things in my app.

Here is my plist content. Can you spot anything that is corrupted? Thanks. (I already checked SO: Empty Settings Bundle in Xcode 4.2 and it doesn't help.)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>PreferenceSpecifiers</key>
    <array>
        <dict>
            <key>Type</key>
            <string>PSGroupSpecifier</string>
        </dict>
        <dict>
            <key>Type</key>
            <string>PSMultiValueSpecifier</string>
            <key>Title</key>
            <string>Initial Magnification</string>
            <key>Values</key>
            <array>
                <integer>1</integer>
                <integer>2</integer>
                <integer>3</integer>
            </array>
            <key>Titles</key>
            <array>
                <string>1x</string>
                <string>2x</string>
                <string>3x</string>
            </array>
            <key>Key</key>
            <string>LuminInitialMagnificationKey</string>
            <key>DefaultValue</key>
            <integer>2</integer>
        </dict>
        <dict>
            <key>Type</key>
            <string>PSToggleSwitchSpecifier</string>
            <key>Title</key>
            <string>Large Lock Button</string>
            <key>Key</key>
            <string>LuminLockButtonEmphasis</string>
            <key>DefaultValue</key>
            <true/>
        </dict>
        <dict>
            <key>Type</key>
            <string>PSToggleSwitchSpecifier</string>
            <key>Title</key>
            <string>Picture-in-Picture Frame</string>
            <key>Key</key>
            <string>LuminOutlineEnabled</string>
            <key>DefaultValue</key>
            <true/>
        </dict>
        <dict>
            <key>Type</key>
            <string>PSGroupSpecifier</string>
            <key>Title</key>
            <string>Sound</string>
        </dict>
        <dict>
            <key>DefaultValue</key>
            <false/>
            <key>Key</key>
            <string>LuminFocusBeepKey</string>
            <key>Title</key>
            <string>Focus Beep</string>
            <key>Type</key>
            <string>PSToggleSwitchSpecifier</string>
        </dict>
        <dict>
            <key>Type</key>
            <string>PSGroupSpecifier</string>
            <key>Title</key>
            <string>Share Options</string>
        </dict>
        <dict>
            <key>Type</key>
            <string>PSChildPaneSpecifier</string>
            <key>Title</key>
            <string>Mail</string>
            <key>File</key>
            <string>EmailSettings</string>
        </dict>
        <dict>
            <key>Type</key>
            <string>PSChildPaneSpecifier</string>
            <key>Title</key>
            <string>Tweet</string>
            <key>File</key>
            <string>TweetSettings</string>
        </dict>
        <dict>
            <key>Type</key>
            <string>PSChildPaneSpecifier</string>
            <key>Title</key>
            <string>Facebook</string>
            <key>File</key>
            <string>FacebookSettings</string>
        </dict>
        <dict>
            <key>Type</key>
            <string>PSGroupSpecifier</string>
            <key>Title</key>
            <string>History</string>
            <key>FooterText</key>
            <string>Tagged images will not be deleted. Dropbox mirroring is queued until WiFi connectivity is available.</string>
        </dict>
        <dict>
            <key>Type</key>
            <string>PSMultiValueSpecifier</string>
            <key>Title</key>
            <string>Delay Before Saving</string>
            <key>Values</key>
            <array>
                <string>1</string>
                <string>3</string>
                <string>5</string>
                <string>7</string>
            </array>
            <key>DefaultValue</key>
            <string>3</string>
            <key>Titles</key>
            <array>
                <string>1 second</string>
                <string>3 seconds</string>
                <string>5 seconds</string>
                <string>7 seconds</string>
            </array>
            <key>Key</key>
            <string>LuminTimeToWaitBeforeHistoryKey</string>
        </dict>
        <dict>
            <key>Type</key>
            <string>PSTextFieldSpecifier</string>
            <key>Title</key>
            <string>Number of Images to Keep</string>
            <key>Key</key>
            <string>LuminNumberOfHistoryFilesKey</string>
            <key>DefaultValue</key>
            <string>100</string>
            <key>KeyboardType</key>
            <string>NumberPad</string>
        </dict>
        <dict>
            <key>DefaultValue</key>
            <false/>
            <key>Key</key>
            <string>LuminDropboxActive</string>
            <key>Title</key>
            <string>Mirror to Dropbox</string>
            <key>Type</key>
            <string>PSToggleSwitchSpecifier</string>
        </dict>
        <dict>
            <key>Type</key>
            <string>PSGroupSpecifier</string>
            <key>FooterText</key>
            <string>Lumin™ © 2011-2012 M. Zabetian & BitsOnTheGo.com.  All rights reserved.  Special Thanks to Tim Smith and AppliedDesign.tv.</string>
        </dict>
        <dict>
            <key>Type</key>
            <string>PSTitleValueSpecifier</string>
            <key>DefaultValue</key>
            <string>Unknown</string>
            <key>Title</key>
            <string>Version</string>
            <key>Key</key>
            <string>AppVersionStringKey</string>
        </dict>
    </array>
    <key>StringsTable</key>
    <string>Root</string>
</dict>
</plist>
1
I've noticed this problem as well, I think it's a bug in Xcode. It happens to me almost every time I modify a .plist manually (in code), and Xcode insists the file is corrupted when I insist it isn't. The only way I've found to avoid this completely is to only modify the file in Xcode's UI. - Mick MacCallum
I think I might have figured it out. Do you, @MDT, have an "&" anywhere in your plist? - mahboudz
I'm assuming that's what did it for you, and no I don't I'm starting to think Xcode just has a problem with me. - Mick MacCallum

1 Answers

1
votes

I have resolved this. I replaced

Zabetian & BitsOnTheGo.com

with

Zabetian and BitsOnTheGo.com

I had to use another text editor as Xcode wouldn't open the file as it claimed it was corrupted. After replacing that ampersand, Xcode could open it and I could build and run my app and see the full Settings pane.

Not sure if this counts as a bug in Xcode or not. Depends whether it is legal to have "&" and characters like it in a settings plist. Not sure why it wouldn't be.