Ios8 是否可以在显示NSLocalNotification之前和计划之后修改其警报正文?

Ios8 是否可以在显示NSLocalNotification之前和计划之后修改其警报正文?,ios8,scheduling,uilocalnotification,Ios8,Scheduling,Uilocalnotification,这是我安排UILocalNotification并每分钟重复一次的代码: UILocalNotification *localNotification = [[UILocalNotification alloc] init]; localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:delay]; localNotification.alertAction = nil; localNotification.soundN

这是我安排UILocalNotification并每分钟重复一次的代码:

UILocalNotification *localNotification = [[UILocalNotification alloc] init];

localNotification.fireDate = [NSDate dateWithTimeIntervalSinceNow:delay];
localNotification.alertAction = nil;
localNotification.soundName = UILocalNotificationDefaultSoundName;

localNotification.alertBody = @"Initial message";
localNotification.alertAction = NSLocalizedString(@"Return to App", nil);
localNotification.repeatInterval = NSCalendarUnitMinute;
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
一旦通知触发,我想更改警报正文(标题等),以反映触发此通知的次数

这是我的代码:

- (void)application:(UIApplication *)app didReceiveLocalNotification:(UILocalNotification *)notif
{
    notif.soundName = UILocalNotificationDefaultSoundName;
    notif.alertBody = @"Changing body"; //This is where I will put the count
}

但是,正文不会更改。

不记得了,但它是否包含setAlertBody方法?

是的,但这相当于直接将警报正文设置为“localNotification.alertBody=@”初始消息“;“您检查过了吗?有时为了分配新值,您需要使用方法而不是属性。是的,我这样做了,没有区别。。。是什么让你们不能创建新的通知并保存它在字段中被触发多少次的值呢?若我创建了一个新的通知,它根本就不起作用。这将是最好的办法