使用Amazon SNS从iOS发送推送通知
问题描述:
我设置了Amazon SNS和iOS应用程序,通过SNS控制台发送推送通知并在iOS中接收。它正常工作。使用Amazon SNS从iOS发送推送通知
现在,我想从一个设备发送推送通知到另一台设备,但我发现了以下错误:
-[AWSServiceInfo initWithInfoDictionary:checkRegion:] | Couldn't read credentials provider configurations from
Info.plist
. Please check yourInfo.plist
if you are providing the SDK configuration values throughInfo.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 [email protected]"hello";
message.message [email protected]"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]);
}];
我不知道我在想什么。
答
为每AWSInfo.m
here调试日志,当你还没有配置您的defaultCognitoCredentialsProvider
你会得到这个错误,因为他们将检查
_cognitoCredentialsProvider = [AWSInfo defaultAWSInfo].defaultCognitoCredentialsProvider;
,如果他们发现_cognitoCredentialsProvider
零,那么你会得到这个错误。
因此正确配置defaultCognitoCredentialsProvider
。
现在错误更改为无权执行:SNS:在资源上发布:arn:aws:sns:us-west-2:XXXXXXXXXX:app/APNS_SANDBOX/XXXXXX sdadsad
该错误表示您无法执行执行此操作,您需要检查您的权限 – Rajat
我在哪里可以检查我的权限? – sdadsad