iOS如何显示桌面应用图标上的推送消息数

//获取用户授权

if (version >= 8.0) {

UIUserNotificationSettings *settings = [UIUserNotificationSettingssettingsForTypes:UIUserNotificationTypeBadge categories:nil];

[[UIApplication sharedApplication] registerUserNotificationSettings:settings];

}

//注册消息推送

if (version >= 8.0) {

UIUserNotificationSettings *settings = [UIUserNotificationSettingssettingsForTypes:UIUserNotificationTypeBadge categories:nil];

[[UIApplication sharedApplication] registerUserNotificationSettings:settings];

[application registerForRemoteNotifications];

}

//设置推送消息个数

[[UIApplication sharedApplication] setApplicationIconBadgeNumber:10];

anyShare分享到: