No, do not do this.
There is a function for this:
id userDefaults = [NSUserDefaults standardUserDefaults];
[userDefaults registerDefaults: defaultSettings];
, PreferenceSpecifiers plist.
- :
- (NSDictionary *)readDefaultSettingsFromPlist: (NSString *)inPath;
{
id mutable = [NSMutableDictionary dictionary];
id settings = [NSDictionary dictionaryWithContentsOfFile: inPath];
id specifiers = [settings objectForKey: @"PreferenceSpecifiers"];
for (id prefItem in specifiers) {
id key = [prefItem objectForKey: @"Key"];
id value = [prefItem objectForKey: @"DefaultValue"];
if ( key && value ) {
[mutable setObject: value
forKey: key];
}
}
return [NSDictionary dictionaryWithDictionary: mutable];
}