推送

//判断 
if ([([UIApplication sharedApplication]currentUserNotificationSettings].types!=UIUserNotificationTypeNone) {
        UILocalNotification *ln =[[UILocalNotification alloc]init];//创建通知对象
        ln.alertBody= @"重大新闻”;//内容
        ln.applicationIconBadgeNumber= 5;//个数
       
        ln.fireDate =[NSDate dateWithTimeIntervalSinceNow:6.0];//第一次发生时间
       // ln.repeatInterval=4;
        ln.timeZone= [NSTimeZone defaultTimeZone];
        //调用通知
        [[UIApplication sharedApplication] scheduleLocalNotification:ln];
       
    }else{
        [[UIApplication sharedApplication]registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert|UIUserNotificationTypeBadge|UIUserNotificationTypeSound  categories:nil]];
    }
一天一章
原文地址:https://www.cnblogs.com/hangman/p/5393571.html