我正在尝试构建一个 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/