美文网首页
UILocalNotification

UILocalNotification

作者: L柠_檬 | 来源:发表于2016-08-19 14:26 被阅读29次
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;
    }
}

相关文章

网友评论

      本文标题:UILocalNotification

      本文链接:https://www.haomeiwen.com/subject/yaybsttx.html