【问题标题】:AWS S3 and Bolts data type issue (Swift 2.0)AWS S3 和 Bolts 数据类型问题 (Swift 2.0)
【发布时间】:2016-01-11 01:51:14
【问题描述】:

我发现的所有关于将图像上传到 AWS S3 存储桶的教程都涉及使用 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 的来源。

【问题讨论】:

    标签: ios swift swift2 aws-sdk-ios


    【解决方案1】:

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

     transferManager.upload(uploadRequest).continueWithExecutor(AWSExecutor.mainThreadExecutor(), withBlock:{ [unowned self]
        task -> AnyObject in
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-06-13
      • 1970-01-01
      • 1970-01-01
      • 2014-10-06
      • 2016-01-04
      • 1970-01-01
      • 2018-09-19
      • 1970-01-01
      相关资源
      最近更新 更多