I have one Toggle Switch in my settings bundle, but it is not working for first time. When i changed the value once again in the settings it is working corrctly.
Even i synchronize before using the value:
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
[userDefaults synchronize];
if([userDefaults boolForKey:@"KeyName"]) {
//Do Some Work
}
What i have to do now?
I think what you are encountering here is the rather strange issue that the settings in your settings bundle are not loaded until the first time the user runs the settings application.
Straight from Apple:
For more info see: Apple’s Documentation