Skip to content

Instantly share code, notes, and snippets.

@davidyeiser
Created November 10, 2013 04:37
Show Gist options
  • Save davidyeiser/7393876 to your computer and use it in GitHub Desktop.
Save davidyeiser/7393876 to your computer and use it in GitHub Desktop.
Registering NSUserDefaults
NSString * const EverydayWeatherUnitTempPrefKey = @"EverydayWeatherUnitTempPrefKey";
NSString * const EverydayWeatherOptShowHelperTaps = @"EverydayWeatherOptShowHelperTaps";
@implementation EverydayWeatherAppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Registers applications default settings
NSArray *dictObjects = [NSArray arrayWithObjects:[NSNumber numberWithInt:1], [NSNumber numberWithBool:YES], nil];
NSArray *dictKeys = [NSArray arrayWithObjects:EverydayWeatherUnitTempPrefKey, EverydayWeatherOptShowHelperTaps, nil];
NSDictionary *defaults = [NSDictionary dictionaryWithObjects:dictObjects forKeys:dictKeys];
[[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
// OTHER STUFF
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment