我正在判断我的应用程序与iOS 8的兼容性,我在控制台"Attempting to badge the application icon but haven't received permission from the user to badge the application"中获得以下登录信息.谁能帮我摆脱这个警告吗.是的,我的应用程序在应用程序图标和TabBar图标上显示徽章.
我正在判断我的应用程序与iOS 8的兼容性,我在控制台"Attempting to badge the application icon but haven't received permission from the user to badge the application"中获得以下登录信息.谁能帮我摆脱这个警告吗.是的,我的应用程序在应用程序图标和TabBar图标上显示徽章.
以下是我在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