swift - 在范围内找不到类型“AWSS3TransferManagerUploadRequest”
问题描述
我是 Swift 的新手。由于我更新了 podfile,我在 AWSS3 中遇到了问题
Cannot find type 'AWSS3TransferManagerUploadRequest' in scope
Cannot find type 'AWSS3TransferManagerDownloadRequest' in scope
ViewController中也有import AWSS3
。
我不明白这个问题。有人面临同样的问题吗?
我也检查这个https://stackoverflow.com/questions/32659346/awss3transfermanageruploadrequest-in-xcode-7
但这无济于事。
var uploadRequests = Array<AWSS3TransferManagerUploadRequest?>()
var uploadFileURLs = Array<URL?>()
var downloadRequests = Array<AWSS3TransferManagerDownloadRequest?>()
func download(_ downloadRequest: AWSS3TransferManagerDownloadRequest) {
switch (downloadRequest.state) {
case .notStarted, .paused:
let transferManager = AWSS3TransferManager.default()
transferManager.download(downloadRequest).continueWith(block: { (task) -> AWSTask<AnyObject>? in
if let error = task.error {
if error.domain == AWSS3TransferManagerErrorDomain as String
&& AWSS3TransferManagerErrorType(rawValue: error.code) == AWSS3TransferManagerErrorType.paused {
print("Download paused.")
} else {
print("download failed: [\(error)]")
}
} else if let exception = task.error {
print("download failed: [\(exception)]")
} else {
DispatchQueue.main.async(execute: { () -> Void in
print("downloaded file url: \(downloadRequest.downloadingFileURL)")
// if let index = self.indexOfDownloadRequest(self.downloadRequests, downloadRequest: downloadRequest) {
// self.downloadRequests[index] = nil
// self.downloadFileURLs[index] = downloadRequest.downloadingFileURL
//
// let indexPath = NSIndexPath(forRow: index, inSection: 0)
// self.collectionView.reloadItemsAtIndexPaths([indexPath])
// }
})
}
return nil
})
break
default:
break
}
}
func downloadAll() {
for (_, value) in self.downloadRequests.enumerated() {
if let downloadRequest = value {
if downloadRequest.state == .notStarted
|| downloadRequest.state == .paused {
self.download(downloadRequest)
}
}
}
// self.collectionView.reloadData()
}
func listObjects() {
let s3 = AWSS3.default()
let listObjectsRequest = AWSS3ListObjectsRequest()
listObjectsRequest?.bucket = "dice-ios"
s3.listObjects(listObjectsRequest!).continueWith { (task) -> AnyObject? in
if let error = task.error {
print("listObjects failed: [\(error)]")
}
if let exception = task.error {
print("listObjects failed: [\(exception)]")
}
if let listObjectsOutput = task.result {
if let contents = listObjectsOutput.contents {
for s3Object in contents {
let downloadingFileURL = URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent("download").appendingPathComponent(s3Object.key!)
let downloadingFilePath = downloadingFileURL.path
if FileManager.default.fileExists(atPath: downloadingFilePath) {
self.downloadRequests.append(nil)
self.downloadFileURLs.append(downloadingFileURL)
} else {
let downloadRequest = AWSS3TransferManagerDownloadRequest()
downloadRequest?.bucket = "dice-ios"
downloadRequest?.key = s3Object.key
downloadRequest?.downloadingFileURL = downloadingFileURL
self.downloadRequests.append(downloadRequest)
self.downloadFileURLs.append(nil)
}
}
DispatchQueue.main.async(execute: { () -> Void in
// self.collectionView.reloadData()
})
}
}
return nil
}
}
我的代码是这样的,因为我更新了 podfile,所以我遇到了问题。我在 AWS3 更新时遇到了问题。我需要知道要更换什么。
解决方案
您需要降级 AWSS3 pod 版本。检查 pod 文件夹以查看您正在使用的工具是否存在(在我的情况下,AWSS3TransferManager.h 从当前版本中丢失,降级到具有它的版本)。
推荐阅读
- c++ - C(++) 短减 short = int?
- javascript - 如何使用 AsyncStorage 在 React Native 中保存我的登录凭据?
- python - 如何获得漂亮的汤功能以从下一页获取 URL
- javascript - 有没有办法让时间输入严格采用 24 小时格式?
- list - 如何在 Haskell 中编写 for 循环?
- charts - 根据每行中的打开和关闭日期识别打开和关闭周数
- python - 你如何在heroku上同时运行flask api和discord bot?
- matlab - 在parfor中增加数组?
- c++11 - 文档函数 Transfer 计算文本文件的行
- nginx - [NGINX]无法让 proxy_pass 和 robots.txt 工作