0
这是我的代码调度UILocalNotificaiton重复每一分钟:是否可以在显示NSLocalNotification之前和之后对它进行修改?
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
}
但是身体没有得到改变。
是的,但它相当于直接设置警报正文“localNotification.alertBody = @”Initial message“;” – mm24
你检查过了吗?有时您需要使用方法替代属性才能分配新值。 –
是的,我做了,没有区别悲伤 – mm24