正在触发本地通知,但不可见。(iOS)

正在触发本地通知,但不可见。(iOS),ios,notifications,local,uilocalnotification,Ios,Notifications,Local,Uilocalnotification,我正在使用以下代码发出本地通知: UILocalNotification *localNotif = [[UILocalNotification alloc] init]; if (localNotif == nil) return; localNotif.fireDate = [NSDate dateWithTimeIntervalSinceNow:30]; //itemDate; localNotif.timeZone = [NSTimeZone defaultTimeZone];

我正在使用以下代码发出本地通知:

UILocalNotification *localNotif = [[UILocalNotification alloc] init];
if (localNotif == nil)
    return;
localNotif.fireDate = [NSDate dateWithTimeIntervalSinceNow:30]; //itemDate;
localNotif.timeZone = [NSTimeZone defaultTimeZone];

// Notification details
localNotif.alertBody = parentController.activeAssignment.notes;
// Set the action button
localNotif.alertAction = @"View";

localNotif.soundName = UILocalNotificationDefaultSoundName;

// Schedule the notification
[[UIApplication sharedApplication] scheduleLocalNotification:localNotif];
我已经用这个方法检查过了

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

通知正在启动,但当应用程序在后台运行时,不会显示在我的屏幕上

您是否已仔细检查以确保
parentController.activeAssignment.notes
不是nil或空字符串?如果通知正在触发,但没有显示,可能是因为它没有显示任何内容。@SeanT是的,我可以在UIAlertView中显示它。我唯一能想到的另一件事是检查你的应用程序是否出于某种原因在设置应用程序的通知部分关闭了通知。我刚刚检查过,出于某种原因它没有显示在那里,但它是10分钟前的。你是在设备上还是在模拟器中测试它?我不确定为什么它不会显示在那里,但我建议删除该应用程序,然后通过Xcode重新安装,然后检查它是否显示在“设置”中。