尝试标记应用程序图标但尚未获得用户的许可以标记应用程序:iOS 8 Xcode 6 [英] Attempting to badge the application icon but haven't received permission from the user to badge the application : iOS 8 Xcode 6
本文介绍了尝试标记应用程序图标但尚未获得用户的许可以标记应用程序:iOS 8 Xcode 6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在检查我的应用程序与iOS 8的兼容性,我正在关注登录控制台尝试标记应用程序图标但尚未获得用户的许可以标记应用程序。任何人都可以帮我摆脱这个警告。是的,我的应用程序在应用程序图标和TabBar图标上显示徽章。
I am checking my app compatibility with iOS 8, I am getting following Log in console "Attempting to badge the application icon but haven't received permission from the user to badge the application" . Can anyone please help me to get rid of this warning. And Yes, my app shows Badges on App Icon and TabBar Icon.
推荐答案
以下是我在AppDelegate中所做的事情
Here is What I did in my AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// registering for remote notifications
[self registerForRemoteNotification];
return YES;
}
- (void)registerForRemoteNotification {
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
UIUserNotificationType types = UIUserNotificationTypeSound | UIUserNotificationTypeBadge | UIUserNotificationTypeAlert;
UIUserNotificationSettings *notificationSettings = [UIUserNotificationSettings settingsForTypes:types categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:notificationSettings];
} else {
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
}
}
#ifdef __IPHONE_8_0
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
[application registerForRemoteNotifications];
}
#endif
这篇关于尝试标记应用程序图标但尚未获得用户的许可以标记应用程序:iOS 8 Xcode 6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文