iOS 推送

来源:互联网 发布:营销软件破解论坛 编辑:程序博客网 时间:2024/06/10 02:13

    UIApplication *application = [UIApplication sharedApplication];

    application.applicationIconBadgeNumber = 0;

    

    //iOS8注册APNS

    if ([application respondsToSelector:@selector(registerForRemoteNotifications)]) {

        [application registerForRemoteNotifications];

        UIUserNotificationType notificationTypes = UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert;

        UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:notificationTypes categories:nil];

        [application registerUserNotificationSettings:settings];

    }else{

        UIRemoteNotificationType notificationTypes = UIRemoteNotificationTypeBadge |

        UIRemoteNotificationTypeSound |

        UIRemoteNotificationTypeAlert;

        [[UIApplication sharedApplication] registerForRemoteNotificationTypes:notificationTypes];

    }



0 0
原创粉丝点击