Possible Duplicate:
Is there anyway to set values in the settings.bundle from within the APP
I'm developing an iPhone app that will at some point prompt a user alerting them that a setting is switched off. From there they can choose to enable it and continue. I'm able to get the settings and use then in my code, the problem is changing them programmatically. Here's what I have
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if(buttonIndex == 1){
// Get the application defaults
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSDictionary *appDefaults = [NSDictionary dictionaryWithObject:@"YES" forKey:@"enabledAutoCheck"];
// Set the new settings and save
[defaults registerDefaults:appDefaults];
[defaults synchronize];
}
}
I'm making a wild guess (since I only started learning Objective-C and iPhone development 3 days ago!) that it has something to do with the fact that this is setting the default settings meaning they are only used if no previous settings are made.
Is this just missing a little something or is there another way to change settings once they've been set initially?
Thanks