swift - 升级 Xcode 后如何修复 'Cannot override a self return type with a non-self return type'

标签 swift amazon-web-services xcode10.2

我正在尝试构建一个 iOS AWS 应用程序,但遇到了一些问题。

我刚刚将 Xcode 更新到 10.2 版并创建了一个全新的项目。我正在尝试使用 CocoaPods 安装依赖项以进行用户身份验证。修改我的 podfile 以包含 AWSMobileClient 后(并按照 AWS 文档所述运行 pod install --repo-update),我在此函数的 AWSMobileClient.swift 中遇到构建错误:

@objc override public class func sharedInstance() -> AWSMobileClient {
   return _sharedInstance
}

错误是这样说的:

Cannot override a Self return type with a non-Self return type

我真的被困在这里了,此时我唯一能想到的就是回到 Xcode 10.1。

如有任何帮助,我们将不胜感激。

最佳答案

作为临时解决方案,将方法的类设为最终。 例如 AWSMobileClient 现在是:

public class AWSMobileClient: _AWSMobileClient {

对此的更改:

public final class AWSMobileClient: _AWSMobileClient {

然后等待 AWS 修复。

关于swift - 升级 Xcode 后如何修复 'Cannot override a self return type with a non-self return type',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55405434/

相关文章:

ios - SwiftUI:警报自动关闭(当它不应该时!)

objective-c - 将MDLMesh划分为多个SCNGeometry

amazon-web-services - 如何允许代入角色从 EC2 连接到 AWS 上的 EKS?

node.js - 如何在Lambda函数中访问API网关请求模型?

amazon-web-services - 我的配置有什么问题? AWS - 使用 MQTT 的物联网

Swift 类上的 Swift 类扩展和类别不允许有 +load 方法

ios - 在 Swift 中声明 Objective-C 方法时出现问题

ios - Swift 泛型 - 无法将值转换为类型

swift - Xcode 10.2 - 使用未声明的类型结果