ios - didReceiveLocalNotification 在 iOS6 中未激活

标签 ios uilocalnotification

最近我在尝试创建一个闹钟,当我使用UILocalNotification时,出现了问题。当应用程序在后台时,它会显示一个横幅,但是当应用程序处于事件状态时,即使我使用了didReceiveLocalNotification,也没有任何反应。 为什么?

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {

UIApplicationState state = application.applicationState;

if (state == UIApplicationStateActive) {
    NSLog(@"RingRingRing~~~~~");
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Remind" message:notification.alertBody delegate:self cancelButtonTitle:@"Sure" otherButtonTitles:nil, nil];
    [alert show];
}

}

最佳答案

远程或本地通知都不会唤醒 iOS 中的应用程序。用户需要对通知执行操作才能启动应用程序。

关于ios - didReceiveLocalNotification 在 iOS6 中未激活,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15102040/

相关文章:

ios - 具有模糊背景的模态导航 Controller ,在推送动画期间无缝?

ios - 检测打开的特定 localNotification

ios13通知内容自定义高度

ios - UIView segue UINavigationBar 闪烁

ios - 如何为特定矩形设置地理围栏?

iphone - iOS - RestKit 并清除所有数据?

iphone - 是否可以在故​​事板的标签中显示最新的推送通知?

iphone - 如何在工作日的选择列表中设置重复的 UILocal 通知

ios - UILocalNotification : set iOS Alarm doesn't work

ios - iOS 中的本地通知