AWS SNS 无法使用 createPlatformEndpoint

AWS SNS can't use createPlatformEndpoint

我在将设备添加到 AWS SNS 主题时遇到一些问题,也许有人可以帮助我。

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

我在使用这段代码时遇到错误: “无法使用类型为 '((task: BFTask!) -> AnyObject!)'

的参数列表调用 'continueWithBlock'

而且我不知道怎么解决。

我已将这些框架包含在我的 Obj-C_bridging 文件中:

#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>

我不知道我还能尝试什么:S 希望任何人都能提供帮助,我们将不胜感激。

您是否正在为 iOS 2.2.x 使用 AWS Mobile SDK? 2.2.0移除了Bolts依赖,需要更新

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

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

查看我们的 blog post 了解更多详情。