我发现的所有关于将图像上传到AWS S3 Buckets的教程都涉及使用Bolts框架。然而,现在我个人正在尝试遵循这些教程,我得到了编译时错误:Cannot convert value of type 'BFExecutor to expected argument type 'AWSExecutor!'
。
在这个代码块上:
transferManager.upload(uploadRequest).continueWithExecutor(BFExecutor.mainThreadExecutor(), withBlock:{ [unowned self]
task -> AnyObject in
// once the uploadmanager finishes check if there were any errors
if(task.error != nil){
NSLog("%@", task.error);
}else{ // if there aren't any then the image is uploaded!
// this is the url of the image we just uploaded
NSLog("https://s3.amazonaws.com/s3-demo-swift/foldername/image.png");
}
self.removeLoadingView()
return "all done";
})
continueWithExecutor方法的预期参数是AWSExecutor!和AWSContinuationBlock!。
我的podfile当前有:
platform :ios, '8.0'
use_frameworks!
pod 'Alamofire'
pod 'SwiftyJSON'
pod 'AWSS3'
pod 'AWSCore'
pod 'AWSCognito'
pod 'AWSSNS'
pod 'Parse'
pod 'Bolts'
亚马逊最近是否更改了他们的SDK并创建了自己的数据类型?我是不是错过了图书馆?我找不到任何不在这一步转移过程中使用Bolts的来源。
您可以尝试将代码更改为:
transferManager.upload(uploadRequest).continueWithExecutor(AWSExecutor.mainThreadExecutor(), withBlock:{ [unowned self]
task -> AnyObject in
现在AWS有Bolt的子类,所以不需要使用Bolt。