XCode 中的 AWSS3TransferManagerUploadRequest 7

AWSS3TransferManagerUploadRequest in XCode 7

我今天升级到 Xcode 7/Swift 2.0。我的项目正在使用 CocoaPods,我正在 POD-file 中导入所有与 AWS 相关的文件,我已经设置了 bridging-header 并导入了亚马逊告诉我的所有文件。在升级到 Swift 2.0 之前,与 AWS 相关的一切工作正常(即将图像上传到 S3 存储桶)

现在升级后,我无法再在我的项目中创建 AWSS3TransferManagerUploadRequest 的实例。该行:

let uploadRequest = AWSS3TransferManagerUploadRequest()

产生错误。

(Use of unresolved identifier 'AWSS3TransferManagerUploadRequest')

知道为什么会这样吗? AWSCognitoCredentialsProvider/AWSServiceConfiguration 代码在我的 AppDelegate.Swift

中运行良好

找到解决方案 - 由于我使用的是 "use_frameworks!",CocoaPods 将所有 pods 从静态库转换为 framerworks。

“通常当您将 Objective-C 代码导入 Swift 时,您通过将包含该代码的文件的 header 包含在“桥接 Header” 用于您的项目。这确实是您从静态库中包含代码的方式(您的 pods 曾经是。)

但这不是您从框架导入 Objective-C 代码的方式。"

所以我简单地添加了

import AWSS3

到我的控制器,一切正常。

在此处找到解决方案:http://rogueleaderr.com/post/115372471213/unresolved-identifier-in-swift-when-importing