gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 05:12:08 24 4
gpt4 key购买 nike

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

这是我的代码:

UIUserNotificationSettings *settings = [UIApplication.sharedApplication currentUserNotificationSettings];

这是我的错误:

use of undeclared identifier 'UIUserNotificationSettings'

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

这是我对 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];

最佳答案

这样做:

#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000

UIUserNotificationSettings *settings = [UIApplication.sharedApplication currentUserNotificationSettings];

#endif

关于ios - 使用未声明的标识符 'UIUserNotificationSettings',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25931515/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com