Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

use of undeclared identifier 'UIUserNotificationSettings'

I am trying to compile an existing application using Xcode 6.

This is my code:

UIUserNotificationSettings *settings = [UIApplication.sharedApplication currentUserNotificationSettings];

This is my error:

use of undeclared identifier 'UIUserNotificationSettings'

I do not know how to resolve this issue.

Here is my check for iOS 8:

if (SYSTEM_VERSION_LESS_THAN(_iOS_8_0)) {

        // Displaying notifications and ringing

        if ([self isMissingMandatoryNotificationTypes:[UIApplication.sharedApplication enabledRemoteNotificationTypes]]) {

            [self registrationWithSuccess:^{
                DDLogInfo(@"Push notifications were succesfully re-enabled");
            } failure:^{
                [self.missingPermissionsAlertView show];
            }];
        }

    } else {

        // UIUserNotificationsSettings
        UIUserNotificationSettings *settings = [UIApplication.sharedApplication currentUserNotificationSettings];
like image 250
Jed Avatar asked Sep 19 '14 10:09

Jed


1 Answers

make it this way:

#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000

UIUserNotificationSettings *settings = [UIApplication.sharedApplication currentUserNotificationSettings];

#endif
like image 185
Andrey Chernukha Avatar answered Oct 05 '22 20:10

Andrey Chernukha