当我将 [NSCalendar +autoupdatingCurrentCalendar] 设置为 UILocalNotification 的重复日历,然后使用 UILocalNotification 调用 [UIApplication -scheduleLocalNotification:] 时,本地通知不会被安排!
这是 iOS 4.3 的错误吗?
这是代码:
UILocalNotification *l = [[UILocalNotification alloc] init];
l.fireDate = [NSDate dateWithTimeIntervalSinceNow:30];
l.alertBody = [NSString stringWithFormat:@"alert time :%@,time zone %@",l.fireDate,l.timeZone];
l.alertAction = @"OK";
l.hasAction = YES;
l.repeatInterval = NSDayCalendarUnit;
l.repeatCalendar = [NSCalendar autoupdatingCurrentCalendar];
[application scheduleLocalNotification:l];
NSLog("all local notifs: %@", [[UIApplication sharedApplication] scheduledLocalNotifications]) //empty array