iOS开发错误:Attempting to badge the application icon but haven't received permission from the user to badge the

UIApplication *app =[UIApplication sharedApplication];   

 app.applicationIconBadgeNumber=10;

错误:

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

这是因为iOS8中,设置左面图标数组需要获取权限。 处理方法:

在第一个函数中添加代码加入

    //   IOS8中,要修改应用的图标需要让用户允许

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

    [[UIApplication sharedApplication] registerUserNotificationSettings:settings];

原文地址:https://www.cnblogs.com/tate-zwt/p/4385029.html