UILocalNotification
2016-08-19 本文已影响29人
L柠_檬
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;
}
}