Search code examples
swiftamazon-s3cocoapodsbolts-frameworkbftask

Bolts framework continueWithBlock error


I've been working AWS s3 for a while now and had little problems until lately. I import the framework through cocoapods. Recently, I reinstalled cocoapods in light of this post.

Afterwards, I had a million and one "use of undeclared type: errors, most in primitive types. I ultimately resolved this (for the most part) by uninstalling cocoapods, reinstalling cocoapods, deleting, cleaning, then reinstalling pods for my specific project (with a bunch of project cleans as well).

I had an issue where Bolts was not included (even though I believe it's part of AWSCore). I added pod Bolts into my Podfile and added #import <Bolts/Bolts.h> into my obj-C -> Swift bridge file.

Now, Bolts was recognized, but I am getting an error "Cannot invoke 'continueWithBlock'" with an argument list of type '((BFTask!) -> _)' error with the following code:

transfer_manager.getObject(request).continueWithBlock(//error here
                    {(task: BFTask!) in
                           //completion logic
                            return nil //was not necessary prior
                    })

bridge.h:

#import <Bolts/Bolts.h> //was unneeded before reinstalling cocoapods
#import <AWSCore/AWSCore.h>
#import <AWSS3/AWSS3.h>
#import <AWSDynamoDB/AWSDynamoDB.h>
#import <AWSSQS/AWSSQS.h>
#import <AWSSNS/AWSSNS.h>
#import <AWSCognito/AWSCognito.h>

finally, my Podfile:

platform :ios, '8.0'enter code here

source 'https://github.com/CocoaPods/Specs.git'
pod 'Bolts' #was unneeded before reinstalling cocoapods
pod 'AWSCore'
pod 'AWSAutoScaling'
pod 'AWSCloudWatch'
pod 'AWSDynamoDB'
pod 'AWSEC2'
pod 'AWSElasticLoadBalancing'
pod 'AWSKinesis'
pod 'AWSLambda'
pod 'AWSMachineLearning'
pod 'AWSMobileAnalytics'
pod 'AWSS3'
pod 'AWSSES'
pod 'AWSSimpleDB'
pod 'AWSSNS'
pod 'AWSSQS'
pod 'AWSCognito'

Any ideas on how to (as I see the problem) get Xcode / Swift to recognize Bolts/BFTask properly again?


Solution

  • You can use AWSTask! in replacement of BFTask! (it is a subclass) to silence xcode.