我正面临UILocalNotifications的问题。我的问题是 - 是否可以在安排后设置uilocalnotification的警报体?
提前感谢。
-------------------------------------
// scheduling uilocalnotification
localNotification = [[UILocalNotification alloc]init];
NSDate *currDate1 = [defaults objectForKey:@"Default_AlarmTime"];
localNotification.fireDate = currDate1;
localNotification.alertBody = @"Alarm";
localNotification.alertAction = @"View";
localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.repeatInterval = NSWeekdayCalendarUnit;
[[UIApplication sharedApplication]scheduleLocalNotification:localNotification];
// changing alert body of existing local notification
Arr=[[UIApplication sharedApplication]scheduledLocalNotifications];
for (int k=0;k<[Arr count];k++)
{
localNotification = [Arr objectAtIndex:k];
NSLog(@"%@",localNotification.fireDate);
dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setTimeZone:[NSTimeZone defaultTimeZone]];
[dateFormat setDateFormat:@"hh:mma"];
dateString = [dateFormat stringFromDate:localNotification.fireDate];
NSLog(@"%@",dateString);
currDate = [defaults objectForKey:@"Default_AlarmTime"];
NSLog(@"%@",currDate);
if ([currDate isEqualToString:dateString])
{
localNotification.alertBody = @"Haiiiiii";
}
}
---------------------------
答案 0 :(得分:0)
据我所知,这是不可能的。要更改已安排的通知,您必须取消并完全重新安排通知。