AWS S3和Bolts数据类型问题(Swift 2.0)

时间:2016-01-11 01:51:15

标签: ios swift swift2 aws-sdk-ios

我发现的有关将图像上传到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并创建了自己的数据类型?我错过了一个图书馆吗?在转移过程的这一步骤中,我找不到任何不使用螺栓的来源。

1 个答案:

答案 0 :(得分:3)

您可以尝试将代码更改为:

@Override
public boolean onOptionsItemSelected(MenuItem item) {
     if (toggle.onOptionsItemSelected(item)) {
         return true;
     }
}

现在AWS有Bolt的子类,所以不需要使用Bolt。