ios8设置application badge value

在ios8中,直接设置application badge value会出错

1 [[UIApplication sharedApplication] setApplicationIconBadgeNumber:count];

曝出”Attempting to badge the application icon but haven‘t received permission from the user to badge the application“的错误。

  原因是因为在ios8中,设置应用的application badge value需要得到用户的许可。使用如下方法咨询用户是否许可应用设置application badge value

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

程序运行时,会弹出提示框给用户

之后再通过

1 [[UIApplication sharedApplication] setApplicationIconBadgeNumber:count];

设置application badge value

ios8设置application badge value

时间: 2024-11-04 14:01:16

ios8设置application badge value的相关文章

iOS8设置应用图标红点的权限问题

在ios8中,直接设置application badge value会出错 1 [[UIApplication sharedApplication] setApplicationIconBadgeNumber:count]; 曝出”Attempting to badge the application icon but haven't received permission from the user to badge the application“的错误. 原因是因为在ios8中,设置应用的

IOS8 设置TableView Separatorinset 分割线从边框顶端开始

IOS8 设置TableView Separatorinset 分割线从边框顶端开始 在ios8上 [TableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];不起作用 经过测试加入下面方法 在ios7 8上都可以正常工作 -(void)viewDidLayoutSubviews{    if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {       

如何在android中利用Theme设置application 的所有listview的style?~

今天看VLC的源代码,发现一个很神奇的东西 所有listview的点击效果背景色都是橘黄色 花了点时间找了一下看看怎么实现的. 首先,定义一个<selector> like this: <selector> <item android:state_pressed="true"> <shape android:shape="rectangle"> <solid android:color="@color/

IOS - Ask for Application Badge permission ios8

UIUserNotificationSettings* notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil]; [[UIApplication sharedApplication] registerUserNo

转 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 U

ios8 设置单元格分割线无效

原来: [self.tableView setSeparatorInset:UIEdgeInsetsMake(0, 0, 0, 0)];//分隔线紧贴左右边框 || [self.tableView setSeparatorInset:UIEdgeInsetsZero]; 现在ios8:①需要再Viewdidload里添加 if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) { [self.tableView

(转) IOS8 设置TableView Separatorinset 分割线从边框顶端开始

在ios8上 [TableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];不起作用 经过测试加入下面方法 在ios7 8上都可以正常工作 1 -(void)viewDidLayoutSubviews 2 { 3 if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) { 4 [self.tableView setSeparatorInset:UIEdgeIns

iOS8 The application could not be verified.

刚升级到最新的iOS和XCode,重新部署程序,报错:The application could not be verified. 找不到原因,将程序Bundle identifier改个名字,就可以了. 可能的原因是,开发者证书续费,将Provitioning Profile重新生成了,应该是PAD上已安装的App证书与新部署的App证书有冲突. 将原有App删除或用新的Bundle identifier都可以.

ios8 设置导航栏颜色

self.navigationController.navigationBar.barTintColor = [UIColor blueColor];