如果在ios中发出通知时从后台删除应用程序,则不会触发didReceiveLocalNotification

时间:2013-06-07 05:19:00

标签: iphone ios ios4

我设置了一个本地通知,它会以一定的间隔被触发,当我点击横幅时,会调用“didReceiveLocalNotification”。现在当我从后台删除应用程序时,当我在横幅上选项卡时,通知会再次出现但是这个时间“didReceiveLocalNotification”未调用。请告诉我如何知道在这种情况下通知解雇。

1 个答案:

答案 0 :(得分:3)

如果应用程序未在后台运行 didReceiveLocalNotification ,则不会调用 应用程序didFinishLaunchingWithOptions: 调用。在启动选项中,您可以查看通知

 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

// If application is launched due to alarm notification, provide the option to snooze it.
UILocalNotification *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];

  if (notification)
  {
    // application is launched due to notification
  }
}