在ios 9中设置应用程序徽章编号 [英] Set the application badge number in ios 9
本文介绍了在ios 9中设置应用程序徽章编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用过
[UIApplication sharedApplication].applicationIconBadgeNumber = 5;
用于设置应用程序徽章编号。它不能单独在ios 9中使用。
for setting application badge number. It's not working in ios 9 alone.
任何人都可以建议为什么?
Can anyone suggest why?
我试过了,
[[UIApplication sharedApplication] setApplicationIconBadgeNumber:5];
推荐答案
您需要注册这样的UIUserNotificationSettings
Hi You need to register UIUserNotificationSettings like this
UIUserNotificationSettings* notificationSettings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];
[UIApplication sharedApplication].applicationIconBadgeNumber = 1;
这篇关于在ios 9中设置应用程序徽章编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文