首页 > 代码库 > 转 How to correctly set application badge value in iOS 8?

转 How to correctly set application badge value in iOS 8?

o modify the badge under ios8 you have to ask for permissions

    let settings = UIUserNotificationSettings(forTypes: UIUserNotificationType.Badge, categories: nil)    UIApplication.sharedApplication().registerUserNotificationSettings(settings)

or in objC

UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge categories:nil];[[UIApplication sharedApplication] registerUserNotificationSettings:settings];

转 How to correctly set application badge value in iOS 8?