質問

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