In my AppDelegate.m I'm trying to initialize the default values from my Preference Bundle if the user hasn't gone to the settings pane yet. The initialize runs, and I see the correct number of objects for my preferences but they're all null and nothing gets set.
+ (void)initialize {
NSLog(@"Running settings initialization");
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *settingsBundle =
[[NSBundle mainBundle] pathForResource:@"Settings" ofType:@"bundle"];
NSDictionary *settings =
[NSDictionary dictionaryWithContentsOfFile:
[settingsBundle stringByAppendingPathComponent:@"Root.plist"]];
NSArray *preferences = [settings objectForKey:@"PreferenceSpecifiers"];
NSMutableDictionary *defaultsToRegister =
[[NSMutableDictionary alloc] initWithCapacity:[preferences count]];
[defaults registerDefaults:defaultsToRegister];
[defaults synchronize];
}
You are registering an empty dictionary.
Use :