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];

posted @ 2015-04-01 19:48  糖醋排骨_zwt  阅读(545)  评论(0编辑  收藏  举报