开发者

How to synchronize with NSUserDefaults in Settings.bundle?

I created my application settings in Settings.bundle. I go into the Se开发者_运维技巧ttings App and update a value. When I relaunch my app (which was in the background), how do I check for the updated settings in the Settings App.

I tried the following but I still get the old value. Any suggestions?

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(checkAutoUpdateSettingsForNotificaiton:) name:UIApplicationDidBecomeActiveNotification object:nil];

- (void)checkAutoUpdateSettingsForNotificaiton:(NSNotification *)aNotification
{
    NSNumber *period = [[[NSUserDefaults standardUserDefaults] objectForKey:@"periodID"] retain];

}


I had to add [[NSUserDefaults standardUserDefaults] synchronize]; to do the synchronization.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜