我试图在我的代码中从 Settings.bundle->Root.plist 获取/设置值:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *val = [defaults objectForKey:@"NUMBER"];
但 val 为零。在我的代码中一切都正确吗?
这是我的 Root.plist
<dict>
<key>Type</key>
<string>PSTitleValueSpecifier</string>
<key>Title</key>
<string>MyTitle</string>
<key>Key</key>
<string>NUMBER</string>
<key>DefaultValue</key>
<string>SavedNumbers</string>
<key>Values</key>
<array>
<string>SavedNumbers</string>
</array>
<key>Titles</key>
<array>
<string>5</string>
</array>
</dict>