[英]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.