Norolim
Norolim

Reputation: 956

AWS SNS can't use createPlatformEndpoint

I have some problems adding devices to a AWS SNS topic and maybe someone can help me.

    let sns = AWSSNS.defaultSNS()
        let request = AWSSNSCreatePlatformEndpointInput()
        request.token = deviceTokenString
        request.customUserData = "XXXXXXXX"
        request.platformApplicationArn = "XXXXXXXXXXXX"
sns.createPlatformEndpoint(request).continueWithBlock({ (task: BFTask!) -> AnyObject! in
                if task.error != nil {
                    println("Error: \(task.error)")
                } else {
                    let createEndpointResponse = task.result as AWSSNSCreateEndpointResponse
                    println("endpointArn: \(createEndpointResponse.endpointArn)")
                }

                return nil
            }) 

I've got an error using this code: "Cannot invoke 'continueWithBlock' with an argument list of type '((task: BFTask!) -> AnyObject!)'

And i don't know how to solve it.

I've included these frameworks in my Obj-C_bridging file:

#import <AWSCore/AWSCore.h>
#import <AWSS3/AWSS3.h>
#import <AWSDynamoDB/AWSDynamoDB.h>
#import <AWSSQS/AWSSQS.h>
#import <AWSSNS/AWSSNS.h>
#import <AWSCognito/AWSCognito.h>
#import <Bolts/BFTask.h>

I don't know what else i can try :S Hope anyone can help, it will be appreciated.

Upvotes: 0

Views: 734

Answers (1)

Yosuke
Yosuke

Reputation: 3759

Are you using the AWS Mobile SDK for iOS 2.2.x? The Bolts dependency was removed in 2.2.0, and you need to update

sns.createPlatformEndpoint(request).continueWithBlock({ (task: BFTask!) -> AnyObject! in

to

sns.createPlatformEndpoint(request).continueWithBlock({ (task: AWSTask!) -> AnyObject! in

See our blog post for more details.

Upvotes: 1

Related Questions