1
- 应用程序在iPhone上运行,用户点击主页按钮一次,应用程序将进入后台。
- 2或3秒后本地通知到达,用户点击本地通知。
- 应用程序将再次进入前景并成为活动,并且
didReceiveLocalNotification
将被调用。
如何通过点击本地通知而不是应用程序图标来确定应用程序变为活动状态。如何通过点击本地通知确定应用程序变为活动
didReceiveLocalNotification
将被调用。如何通过点击本地通知而不是应用程序图标来确定应用程序变为活动状态。如何通过点击本地通知确定应用程序变为活动
这里是检测什么是你的应用程序的状态时,发射UILocalNotification
一个简单的方法,如果
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification
叫,这可以确保本地通知被接收。
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
UIApplicationState state = [application applicationState];
if (state == UIApplicationStateInactive) {
// Application was in the background when notification was delivered.
} else {
}
}
这看起来像http://stackoverflow.com/questions/32061897/ios-push-notification-how-to-detect-if-the-user-tapped-on-notification-when的可能欺骗-The –