【问题标题】:Send push notification from iOS using Amazon SNS使用 Amazon SNS 从 iOS 发送推送通知
【发布时间】:2016-12-01 15:09:22
【问题描述】:

我将它设置为 Amazon SNS 和 iOS 应用程序以通过 SNS 控制台发送推送通知并在 iOS 中接收。它工作正常。

现在,我正在尝试将推送通知从一台设备发送到另一台设备,但出现以下错误:

-[AWSServiceInfo initWithInfoDictionary:checkRegion:] |无法从 Info.plist 读取凭据提供程序配置。请检查 您的 Info.plist 如果您提供 SDK 配置值 通过Info.plist

这是我发送推送通知的代码

AWSSNS *publishCall = [AWSSNS defaultSNS];

AWSSNSPublishInput *message = [AWSSNSPublishInput new];

message.subject = @"My First Message";


//This is the ending point
message.targetArn = @"arn:aws:sns:us-west-2:895047407854:endpoint/APNS_SANDBOX/XXXXX/XXXX-XXXX-XXX-XXXX";
message.subject =@"hello";
message.message =@"teste from device";
//    message.messageAttributes = messageDict;
//
//    message.messageStructure = jsonString;

    [publishCall publish:message completionHandler:^(AWSSNSPublishResponse * _Nullable response, NSError * _Nullable error) {
        if(error) NSLog(@"%@", [error userInfo]);
        if(response) NSLog(@"%@", [response description]);
    }];

我不知道我错过了什么。

【问题讨论】:

    标签: ios objective-c amazon-web-services amazon-sns


    【解决方案1】:

    根据AWSInfo.mhere的调试日志,当你没有配置你的defaultCognitoCredentialsProvider时你会得到这个错误

    他们会检查的

    _cognitoCredentialsProvider = [AWSInfo defaultAWSInfo].defaultCognitoCredentialsProvider;
    

    如果他们找到_cognitoCredentialsProvider nil 那么你会得到这个错误。

    所以正确配置defaultCognitoCredentialsProvider

    【讨论】:

    • 现在错误改为not authorized to perform: SNS:Publish on resource: arn:aws:sns:us-west-2:XXXXXXXXXX:app/APNS_SANDBOX/XXXXXX<
    • 该错误表示您无法执行此操作,您需要检查您的权限
    • 我在哪里可以查看我的权限?
    • 谢谢!我确实检查了文档并添加了发布角色:D
    猜你喜欢
    • 1970-01-01
    • 2015-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多