0

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];
halfer
  • 19,824
  • 17
  • 99
  • 186
Developer
  • 6,375
  • 12
  • 58
  • 92

2 Answers2

0

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

Community
  • 1
  • 1
Sandro Machado
  • 9,921
  • 4
  • 36
  • 57
  • But I am getting compile time error for "registerUserNotificationSettings". How can I create a build? – Developer Oct 14 '14 at 17:55
  • The "registerUserNotificationSettings" is not available in iOS7. Replace your code for this code: [[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)]; – Sandro Machado Oct 14 '14 at 20:08
  • They will work fine, beacause when you use xcode 5 the application will be compiled with iOS7 – Sandro Machado Oct 15 '14 at 09:55
  • No it won't because iOS7 SDK doesn't know about "registerUserNotificationSettings". I tried that already – Developer Oct 15 '14 at 10:17
  • I think you didnt understand me. Replace this code: UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeBadge|UIRemoteNotificationTypeSound|UIRemoteNotificationTypeAlert) categories:nil]; [[UIApplication sharedApplication] registerUserNotificationSettings:settings]; [[UIApplication sharedApplication] registerForRemoteNotifications]; for this: [[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)]; – Sandro Machado Oct 15 '14 at 10:28
0

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.

LinusGeffarth
  • 27,197
  • 29
  • 120
  • 174