gpt4 book ai didi

ios - 如何设置Info.Plist以使AWSSNS.defaultSNS工作

转载 作者:行者123 更新时间:2023-12-01 19:58:24 28 4
gpt4 key购买 nike

尝试从AWSSNS获取defaultSNS时出现错误。它说 :

'NSInternalInconsistencyException', reason: 'The service configuration
is `nil`. You need to configure `Info.plist` or set `defaultServiceConfiguration`
before using this method.'

我正在处理从MobileHub集成页面下载的示例文件,我的代码位于PushNotificationViewController中。如下:
override func viewDidLoad() {
super.viewDidLoad()
let pushManager: AWSPushManager = AWSPushManager.defaultPushManager()
pushManager.delegate = self
pushManager.registerForPushNotifications()
pushNotificationSwitch.on = pushManager.enabled
if let topicARNs = pushManager.topicARNs {
pushManager.registerTopicARNs(topicARNs)
}

let someDict:[String:String] = ["CustomUserData":"This is test data"]
var attr = AWSSNSSetEndpointAttributesInput()
attr.attributes = someDict
attr.endpointArn = "arn:aws:sns:xxxxxxxx"
let defSns = AWSSNS.defaultSNS() <-- Error is here
defSns.setEndpointAttributes(attr)

}

最佳答案

没关系,我找到了解决方案。只需从PushManager复制粘贴相同的值,然后将PushManager更改为SNS。瞧,作品就像魅力。

关于ios - 如何设置Info.Plist以使AWSSNS.defaultSNS工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41209954/

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