UILocalNotification *notification =[[UILocalNotification alloc]init];
notification.fireDate =[NSDate dateWithTimeIntervalSinceNow:1];
notification.repeatInterval =kCFCalendarUnitDay;
notification.soundName =UILocalNotificationDefaultSoundName;
notification.alertBody =@"记得吃饭";
notification.applicationIconBadgeNumber =1;
notification.userInfo=[NSDictionary dictionaryWithObject:@"1" forKey:@"identify"];
[[UIApplication sharedApplication]scheduleLocalNotification:notification];
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
if (notification) {
NSLog(@"[%@]",notification.alertBody);
application.applicationIconBadgeNumber=0;
}
}
网友评论