Which xcode to be used to upload new version on iTunes compatible with iOS 8?

给你一囗甜甜゛ 提交于 2019-12-12 04:45:50

问题


I have to upload newer version of my app which is compatible to iOS 8. When I am uploading the app from Xcode 6.1 (Not Beta) I am getting following error

Apps and app updates submitted to the App Store must be built with Xcode 5.1.1 or later, and iOS 7 or later SDK.

and when I am uploading the app with XCode 5.1.1 I am not able to use the following code for Push Notification.

UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeSound|UIRemoteNotificationTypeAlert) categories:nil];
[[UIApplication sharedApplication] registerUserNotificationSettings:settings];
[[UIApplication sharedApplication] registerForRemoteNotifications];

回答1:


Your app needs to be compiled with iOS7 and build with xcode 5 so you cannot use new API's that are only available in iOS8.

you need to use this code:

    // 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)];
    }
}

more info here:iOS 8 enabled device not receiving PUSH notifications after code update




回答2:


As far as I know you have to open and run the project once in xcode 6 to ensure iPhone 6/6+ and iOS 8 support. Then upload via xcode.



来源:https://stackoverflow.com/questions/26366453/which-xcode-to-be-used-to-upload-new-version-on-itunes-compatible-with-ios-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!