构建适用于iOS,如果registerForRemoteNotificationTypes:不支持的iOS 8.0及更高版本 [英] Building for iOS if registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later
问题描述
如果有与设备的通知如何报名重大更改,我们不能用registerForRemoteNotificationTypes:了,我们如何能够构建应用程序的新版本支持iOS 8的,如果我们不能用X code 6测试版?我们必须建立并提交当日X code 6 GM版发布我们的用户继续得到推送通知?
If there are breaking changes with how devices register for notifications, and we cannot use registerForRemoteNotificationTypes: anymore, how can we build a new version of the app to support iOS 8 if we cannot use Xcode 6 beta? Will we have to build and submit the day the Xcode 6 GM version is released for our users to continue to get push notifications?
推荐答案
iOS 8的改变通知注册。所以,你需要检查设备版本,然后你需要注册通知设置。(请查看这个链接。)
我尝试在X code 6和它的工作对我来说这code。
iOS 8 has changed notification registration. So you need to check device version and then you need to register notification settings.(please check this link.) I try this code on Xcode 6 and its worked for me.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
{
[[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge) categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
else
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert)];
}
return YES;
}
这篇关于构建适用于iOS,如果registerForRemoteNotificationTypes:不支持的iOS 8.0及更高版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!