gpt4 book ai didi

ios - 无法调用非函数类型的值 'AWSSNS'

转载 作者:行者123 更新时间:2023-11-30 12:13:27 25 4
gpt4 key购买 nike

我在我的应用程序中使用 AWSNS,该应用程序是用 Swift 3.0 编写的。我在注册函数的一行代码中遇到了Can't Call Value of non Function Type 'AWSSNS' 错误。

以下是我的代码:

 func myfunction(){
initial()
let tkn = nd.value(forKey: "devicetoken") as! String
var myArn: String = myARN

var platformEndpointRequest = AWSSNSCreatePlatformEndpointInput()
platformEndpointRequest?.customUserData = "MyUserID;iPhone7"
platformEndpointRequest?.token = tkn

platformEndpointRequest?.platformApplicationArn = SNSPlatformApplicationArn
//var snsManager.... this line below is giving error
var snsManager = AWSSNS()(configuration: configuration)
var endpt = snsManager.createPlatformEndpoint(platformEndpointRequest)

}

如果有人帮忙,我将不胜感激。

最佳答案

它对我有用:

 let sns = AWSSNS.defaultSNS()
let request = AWSSNSCreatePlatformEndpointInput()
request.token = deviceTokenString
request.platformApplicationArn = SNSPlatformApplicationArn
sns.createPlatformEndpoint(request).continueWith(executor: AWSExecutor.mainThreadExecutor(), block: { (task: AWSTask!) -> AnyObject! in
if task.error != nil {
print("Error: \(task.error)")
} else {
let createEndpointResponse = task.result as! AWSSNSCreateEndpointResponse
print("endpointArn: \(createEndpointResponse.endpointArn)")
NSUserDefaults.standardUserDefaults().setObject(createEndpointResponse.endpointArn, forKey: "endpointArn")
}

return nil
})

关于ios - 无法调用非函数类型的值 'AWSSNS',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45730716/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com