I assume you encountered this problem since you did not register your default values.
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:@"defaultValueFOrKey", @"Key", nil]];
In normal practice, we will create a plist file with default values ββfor all keys in the parameter set for this purpose and register it as
[[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Defaults" ofType:@"plist"]]];
source share