在设置包中,我有一个多选选项。因此,当我选择某些内容时,应用程序应该接收新值并使用它来启动 UILocalNotification。我尝试过的只是在打开应用程序时更新值。
- (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];
}