我正在检查我的应用程序与 iOS 8 的兼容性,我正在关注登录控制台“尝试标记应用程序图标,但未收到用户授予应用程序标记的权限”。谁能帮我摆脱这个警告。是的,我的应用在应用图标和 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
关于objective-c - 尝试标记应用程序图标,但未获得用户标记应用程序的权限 : iOS 8 Xcode 6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25973364/