[英]How to synchronize with NSUserDefaults in Settings.bundle?
我在Settings.bundle
创建了我的应用程序设置。 我进入Settings App
并更新值。 当我重新启动我的应用程序(在后台)时,如何在“ Settings App
检查更新的Settings App
。
我尝试了以下但我仍然得到了旧的价值。 有什么建议?
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(checkAutoUpdateSettingsForNotificaiton:) name:UIApplicationDidBecomeActiveNotification object:nil];
- (void)checkAutoUpdateSettingsForNotificaiton:(NSNotification *)aNotification
{
NSNumber *period = [[[NSUserDefaults standardUserDefaults] objectForKey:@"periodID"] retain];
}
我不得不添加[[NSUserDefaults standardUserDefaults] synchronize];
进行同步。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.