Attempting to badge the application icon but haven't received permission from the user to badge the

报错Attempting to badge the application icon but haven't received permission from the user to badge the application


因为在iOS 7.1之后,设置应用的application badge value需要得到用户的许可,需要判读iOS版本


#ifdef SUPPORT_IOS8

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) {


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


    [[UIApplication sharedApplication] registerUserNotificationSettings:settings];

   

}

#endif


你可能感兴趣的:(ios,application)