我安排了本地通知当天+1和时间说早上10点。当我将设备日期更改为当天+ 1和时间晚上10点时,通知没有显示。
代码如下:
UILocalNotification * localNot = [[UILocalNotification alloc] init];
localNot.userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
@"ReminderId", @"REM01", nil];
localNot.alertBody = @"Alarm";
NSString *str =@"10/15/2014 9:15 AM";
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
formatter.timeZone = [NSTimeZone defaultTimeZone];
[formatter setDateFormat:@"MM/dd/yyyy hh:mm a"];
NSDate *date = [formatter dateFromString:str];
localNot.timeZone = [NSTimeZone defaultTimeZone];
localNot.fireDate = date;
localNot.repeatInterval = 0;
[[UIApplication sharedApplication] scheduleLocalNotification:localNot];
需要输入。谢谢。