推送

//判断 
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]];
    }
posted @ 2016-04-14 23:19  huangyan1022  阅读(127)  评论(0编辑  收藏  举报