标签:
IOS7:
上面的代码可以搞定
IOS8:
iOS8中设置application badge value 会抛错:Attempting to badge the application icon but haven‘t received permission from the user to badge the
原因是因为在ios8中,设置应用的application badge value需要得到用户的许可。使用如下方法咨询用户是否许可应用设置application badge value
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
在这之前要判断系统是否为iOS8的系统,否则8之前的系统会报错。
注意:清除数字请将数字设置为 0
标签:
原文地址:http://www.cnblogs.com/wskgjmhh/p/4761697.html