0

I have a toggle switch in Settings bundle with boolean value and I have if-else statement in my code depending on this toggle switch. I specified the default value to be YES. Every time I install my app, its loading the default values I specified. However, after I install my app, if I go back to settings and toggle the switch over there and then run the app again, its not reading the updated value. I want the app to consider the changes made in settings and act accordingly. Is there any delegate that I can use/write in order to accomplish this ?

user1982519
  • 515
  • 5
  • 24

1 Answers1

0

You have two options:

1) use [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleSettingsBundleChange) name:NSUserDefaultsDidChangeNotification object:nil];

OR

2) check the settings bundle values every time your apps load, returns from background, etc.

Personally I'd use the first option since it's a one-stop shop.

Dan
  • 5,153
  • 4
  • 31
  • 42