Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine when Settings change on iOS

I have created a custom Settings.app bundle using the standard root.plist approach for the iPhone. I'm wondering if there's a way to determine when the user changes those settings in my app...

like image 850
Ben Avatar asked Oct 13 '10 19:10

Ben


People also ask

How do I change iOS settings?

In the Settings app , you can search for iPhone settings you want to change, such as your passcode, notification sounds, and more. Tap Settings on the Home Screen (or in the App Library). Swipe down to reveal the search field, enter a term—“iCloud,” for example—then tap a setting.

Where is Account overview on my iPhone?

To access your account settings from the iOS app, login to the app and tap My account at the bottom right corner of the screen. Then tap the gear icon in the upper right corner to access Account Settings.

How do I turn off iPhone notifications at night?

Go to Settings > Do Not Disturb. Turn on Scheduled and set a schedule. Choose when you want to receive alerts, calls, and notifications: Silence: Choose to silence calls and notifications always or only when the device is locked.


1 Answers

You can listen for NSUSerDefaultsDidChange-notifications with this:

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

Whenever the NSUserDefaults changes, defaultsChanged will be called.

Don't forget to call [[NSNotificationCenter defaultCenter] removeObserver:self]; when you want to stop listening for these notifications (you should also do this when object gets deallocated).

like image 92
Emil Avatar answered Sep 24 '22 20:09

Emil