iosswiftswift2aws-sdk-ios

AWS S3 and Bolts data type issue (Swift 2.0)


All of the tutorials I have found regarding uploading images to AWS S3 Buckets involve using the Bolts frameworks. However, now that I am personally trying to follow these tutorials I am getting the compile time error: Cannot convert value of type 'BFExecutor to expected argument type 'AWSExecutor!'.

On this block of code:

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";
    })

The expected arguments for the continueWithExecutor method are AWSExecutor! and AWSContinuationBlock!.

My podfile currently has:

platform :ios, '8.0'
use_frameworks!


pod 'Alamofire'
pod 'SwiftyJSON'
pod 'AWSS3'
pod 'AWSCore'
pod 'AWSCognito'
pod 'AWSSNS'
pod 'Parse'
pod 'Bolts'

Has Amazon changed their SDK recently and created their own data types? Am I missing a library? I can't find any sources that don't use Bolts in this step of the transfer process.


Solution

  • You can try change code to:

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

    Now AWS have subclass of Bolt so don't need use Bolt.