문제

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