我刚刚开始使用首选项文件,并且在编辑设置包中的 root.plist 时立即开始遇到问题。每次我将属性添加到 plist 并将其编辑为属性列表时,我的 XCode 4 都会崩溃。所以我想我会简单地编辑为源代码。似乎容易了很多。
但是当我运行程序时,root.plist 没有被读取。(它与来自演示程序的设置包一起工作正常。我正在使用 InAppSettingsKit。)我查看了源代码编辑器中的 root.plist,它看起来正确。我试图将其视为属性列表,但收到一条错误消息,提示 plist 已损坏。
这是我的 plist 的内容。有人可以告诉我它有什么问题吗?
<?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>
<!-- Databases -->
<dict>
<key>Title</key> <string>Databases</string>
<key>Type</key> <string>PSGroupSpecifier</string>
</dict>
<dict>
<key>Type</key> <string>PSToggleSwitchSpecifier</string>
<key>Title</key> <string>db0</string>
<key>Key</key> <string>db0_preference</string>
<key>DefaultValue</key> <true/>
</dict>
<dict>
<key>Type</key> <string>PSToggleSwitchSpecifier</string>
<key>Title</key> <string>db1</string>
<key>Key</key> <string>db1_preference</string>
<key>DefaultValue</key> <true/>
</dict>
<!-- Sharing Actions -->
<dict>
<key>Type</key> <string>PSGroupSpecifier</string>
<key>Title</key> <string>Sharing Actions</string>
</dict>
<dict>
<key>Type</key> <string>PSToggleSwitchSpecifier</string>
<key>Title</key> <string>Facebook</string>
<key>Key</key> <string>facebook_preference</string>
<key>DefaultValue</key> <true/>
</dict>
<dict>
<key>Type</key> <string>PSToggleSwitchSpecifier</string>
<key>Title</key> <string>Twitter</string>
<key>Key</key> <string>twitter_preference</string>
<key>DefaultValue</key> <true/>
</dict>
<dict>
<key>Type</key> <string>PSToggleSwitchSpecifier</string>
<key>Title</key> <string>Email</string>
<key>Key</key> <string>email_preference</string>
<key>DefaultValue</key> <true/>
</dict>
<dict>
<key>Type</key> <string>PSToggleSwitchSpecifier</string>
<key>Title</key> <string>BlogSpot</string>
<key>Key</key> <string>blogspot_preference</string>
<key>DefaultValue</key> <true/>
</dict>
<!-- Automatic Email Enable -->
<dict>
<key>Type</key> <string>PSGroupSpecifier</string>
<key>Title</key> <string>Automatic Emailing</string>
</dict>
<dict>
<key>Type</key> <string>PSToggleSwitchSpecifier</string>
<key>Title</key> <string>Always Send to Email</string>
<key>Key</key> <string>autoblogspot_preference</string>
<key>DefaultValue</key> <true/>
</dict>
<!-- Calendar -->
<dict>
<key>Type</key> <string>PSRadioGroupSpecifier</string>
<key>Title</key> <string>First Day of the Week</string>
<key>Key</key> <string>firstDayOfTheWeek_preference</string>
<key>Values</key>
<array>
<integer>0</integer>
<integer>1</integer>
<integer>2</integer>
<integer>3</integer>
<integer>4</integer>
<integer>5</integer>
<integer>6</integer>
</array>
<key>Titles</key>
<array>
<string>Sunday</string>
<string>Monday</string>
<string>Tuesday</string>
<string>Wednesday</string>
<string>Thursday</string>
<string>Friday</string>
<string>Saturday</string>
</array>
</dict>
<dict>
<key>
</array>
<key>StringsTable</key>
<string>Root</string>
</dict>
</plist>