我必须上传与iOS 8兼容的我的应用程序的更新版本。 当我从Xcode 6.1(非Beta)上传应用程序时,我收到以下错误
提交至App Store的应用和应用更新必须使用Xcode 5.1.1或更高版本以及iOS 7或更高版本的SDK构建。
当我使用XCode 5.1.1上传应用程序时,我无法使用以下代码进行推送通知。
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeSound|UIRemoteNotificationTypeAlert) categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
[[UIApplication sharedApplication] registerForRemoteNotifications];
答案 0 :(得分:0)
您的应用需要使用iOS7编译并使用xcode 5构建,因此您无法使用仅在iOS8中可用的新API。
您需要使用此代码:
// changes of API in iOS 8.0
- (void) registerForPushNotification
{
NSLog(@"registerForPushNotification");
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
{
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_8_0 //__IPHONE_8_0 is not defined in old xcode (==0). The use 80000
NSLog(@"registerForPushNotification: For iOS >= 8.0");
[[UIApplication sharedApplication] registerUserNotificationSettings:
[UIUserNotificationSettings settingsForTypes:
(UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge)
categories:nil]];
[[UIApplication sharedApplication] registerForRemoteNotifications];
#endif
} else {
NSLog(@"registerForPushNotification: For iOS < 8.0");
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
}
}
此处有更多信息:iOS 8 enabled device not receiving PUSH notifications after code update
答案 1 :(得分:0)
据我所知,您必须在xcode 6中打开并运行一次项目,以确保支持iPhone 6/6 +和iOS 8。然后通过xcode上传。