UILocalNotification *notification=[[UILocalNotificationalloc] init];
if (notification!=nil) {
NSLog(@">> support local notification");
NSDate *now=[NSDatenew];
notification.fireDate=[now addTimeInterval:10];
notification.timeZone=[NSTimeZonedefaultTimeZone];
notification.alertBody=@"信息";
[notification setApplicationIconBadgeNumber:10];
[notification setSoundName:@"ping.caf"];
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
}
读取所有scheduledLocalNotifications
for(UILocalNotification *aNotif in [[UIApplication sharedApplication] scheduledLocalNotifications]) {
NSLog(@"%@",aNotif.timeZone);
NSLog(@"%@",aNotif.alertBody);
}
NSLog(@"count=%d", [[[UIApplication sharedApplication] scheduledLocalNotifications] count] );