使用未声明的标识符'UIUserNotificationSettings'

Jed*_*Jed 4 objective-c ios ios8

我正在尝试使用Xcode 6编译现有的应用程序.

这是我的代码:

UIUserNotificationSettings *settings = [UIApplication.sharedApplication currentUserNotificationSettings];
Run Code Online (Sandbox Code Playgroud)

这是我的错误:

use of undeclared identifier 'UIUserNotificationSettings'
Run Code Online (Sandbox Code Playgroud)

我不知道如何解决这个问题.

这是我对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];
Run Code Online (Sandbox Code Playgroud)

And*_*kha 8

这样做:

#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000

UIUserNotificationSettings *settings = [UIApplication.sharedApplication currentUserNotificationSettings];

#endif
Run Code Online (Sandbox Code Playgroud)