In the settings bundle, I've got a multi choice option. So when I choose something, the app should receive the new value and use it to launch a UILocalNotification. What I've tried, only updates the values when I open the app.

  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions


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

}
- (void)applicationDidEnterBackground:(UIApplication *)application
{

  [[NSUserDefaults standardUserDefaults]synchronize];
}
有帮助吗?

解决方案

If you're not truly running in the background, but suspended then your app will not receive any events until it is awakened by the user or relaunched. If you are running in the background you'll need to poll for changes in the settings bundle and react accordingly.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top