0

我有一个位置应用程序。当用户选择一个地址时,他/她可以在选择的地址之前设置一个半径以得到警报。本地通知设置在didEnterRegion: 我注意到的事情是,如果用户设置警报并关闭应用程序并超过 15 分钟,则不会出现任何通知。有时当用户按下锁定或主页按钮时会触发通知。如果它小于那一切正常。

该应用程序有两个视图。介绍视图,用户可以在其中选择地址和带有地图的第二个视图。

你们知道会发生什么吗?

问候

4

1 回答 1

0

Are you using UILocalNotification?. If you do, you have 2 consider 2 scenarios in your AppDelegate.m:

1) The app was closed.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    //local notification
    UILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];

    if ([[notification.userInfo objectForKey:@"your key"] isEqual:@"your object"])
    {
       // do something
    }
}

2: The app is still alive.

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
   // same as before
}
于 2013-08-16T16:04:02.710 回答