【发布时间】:2010-08-01 02:05:08
【问题描述】:
当我将新条目添加到我的设置捆绑 root.plist 文件、构建并运行应用程序时,新设置在应用程序中不可见。我当然为新条目使用了唯一键。
在我的 xcode 项目的 root.plist 文件中,该文件显示了更改,但是当我通过管理器从 iphone 获取当前文件时,更改不存在。
我使用的是 iOS 4.0.1。
BR, 马丁
【问题讨论】:
标签: iphone ios4 nsuserdefaults
当我将新条目添加到我的设置捆绑 root.plist 文件、构建并运行应用程序时,新设置在应用程序中不可见。我当然为新条目使用了唯一键。
在我的 xcode 项目的 root.plist 文件中,该文件显示了更改,但是当我通过管理器从 iphone 获取当前文件时,更改不存在。
我使用的是 iOS 4.0.1。
BR, 马丁
【问题讨论】:
标签: iphone ios4 nsuserdefaults
删除并重新安装该应用。当应用程序已存在于设备上时,可能无法安装更新的资源。
【讨论】:
+[NSUserDefaults registerDefaults:]
Root.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>StringsTable</key>
<string>Root</string>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>iParkschein Einstellungen</string>
</dict>
<dict>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
<key>Title</key>
<string>Kennzeichen</string>
<key>Key</key>
<string>kennzeichen_preference</string>
<key>DefaultValue</key>
<string></string>
<key>IsSecure</key>
<false/>
<key>KeyboardType</key>
<string>Alphabet</string>
<key>AutocapitalizationType</key>
<string>None</string>
<key>AutocorrectionType</key>
<string>No</string>
</dict>
<dict>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
<key>Title</key>
<string>Stadt</string>
<key>Key</key>
<string>stadt_preference</string>
<key>DefaultValue</key>
<string>Wien</string>
<key>IsSecure</key>
<false/>
<key>KeyboardType</key>
<string>Alphabet</string>
<key>AutocapitalizationType</key>
<string>None</string>
<key>AutocorrectionType</key>
<string>No</string>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>Title</key>
<string>Firmenrechnung</string>
<key>Key</key>
<string>firmenrechnung_preference</string>
<key>DefaultValue</key>
<true/>
</dict>
<dict>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
<key>Title</key>
<string>Kennzeichen</string>
<key>Key</key>
<string>servicenummer_preference</string>
<key>DefaultValue</key>
<string></string>
<key>IsSecure</key>
<false/>
<key>KeyboardType</key>
<string>Alphabet</string>
<key>AutocapitalizationType</key>
<string>None</string>
<key>AutocorrectionType</key>
<string>No</string>
</dict>
</array>
</dict>
</plist>
如果我从 userdefaults 读取密钥并将它们写入控制台,我会得到除 servicenummer_preference 之外的任何密钥
BR, 马丁
【讨论】: