Skip to content

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"];

Post a Comment

Your email is never published nor shared. Required fields are marked *