Skip to content

Monthly Archives: June 2011

Static (Read-only) text in Settings Bundle

Since I couldn’t find this anywhere else I will write it here on my blog, to add a static (read-only) text to the Settings Bundle add this to the plist (easiest using the source code editor). <span style="font-family: monospace;">&lt;dict&gt;</span> <span style="font-family: monospace;">&lt;key&gt;Key&lt;/key&gt;</span> <span style="font-family: monospace;">&lt;string&gt;version_preference&lt;/string&gt;</span> <span style="font-family: monospace;">&lt;key&gt;Type&lt;/key&gt;</span> <span style="font-family: monospace;">&lt;string&gt;PSTitleValueSpecifier&lt;/string&gt;</span> <span style="font-family: monospace;">&lt;key&gt;DefaultValue&lt;/key&gt;</span> <span [...]

Checking if preferences exists on iOS

If you have a settings bundle in your application, this is a good way to check if you can access them, if not you can set the default values for the preferences. id testPreference = [[NSUserDefaults standardUserDefaults] objectForKey:@"sync_preference"]; if (testPreference == nil) { [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"sync_preference"]; }