【问题标题】:Which xcode to be used to upload new version on iTunes compatible with iOS 8?哪个 xcode 用于在与 iOS 8 兼容的 iTunes 上上传新版本?
【发布时间】:2014-10-14 17:12:43
【问题描述】:

我必须上传与 iOS 8 兼容的更新版本的应用程序。 当我从 Xcode 6.1(非测试版)上传应用程序时,出现以下错误

提交到 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];

【问题讨论】:

    标签: xcode ios8 app-store-connect


    【解决方案1】:

    您的应用需要使用 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

    【讨论】:

    • 但我收到“registerUserNotificationSettings”的编译时错误。如何创建构建?
    • “registerUserNotificationSettings”在 iOS7 中不可用。将此代码替换为您的代码: [[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
    • 它们可以正常工作,因为当您使用 xcode 5 时,应用程序将使用 iOS7 编译
    • 不会,因为 iOS7 SDK 不知道“registerUserNotificationSettings”。我已经试过了
    • 我想你不明白我的意思。替换此代码: UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeSound|UIRemoteNotificationTypeAlert) categories:nil]; [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; [[UIApplication sharedApplication] registerForRemoteNotifications];为此:[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
    【解决方案2】:

    据我所知,您必须在 xcode 6 中打开并运行该项目一次,以确保支持 iPhone 6/6+ 和 iOS 8。然后通过xcode上传。

    【讨论】:

    • 在我的问题““当我从 Xcode 6.1(非测试版)上传应用程序时出现以下错误”中看到这一点”
    • 哦,显然误解了你的问题,我的错。对不起,但我不知道答案。还是祝你好运!
    • 没问题,感谢您的尝试。我已经使用 XCode 6.0.1 上传了构建。
    猜你喜欢
    • 2021-02-25
    • 1970-01-01
    • 2017-01-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-29
    • 2016-08-13
    相关资源
    最近更新 更多