sdadsad sdadsad - 1 year ago 187
iOS Question

Send push notification from iOS using Amazon SNS

I set it up Amazon SNS and iOS App to send Push Notification via SNS Console and receive in iOS. It works properly.

Now, I'm trying to send push notification from a device to another device, but I'm getting the following error:

-[AWSServiceInfo initWithInfoDictionary:checkRegion:] | Couldn't read credentials provider configurations from
. Please check
if you are providing the SDK configuration values

There's my code to send push notification

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]);

I don't know what I'm missing.

Answer Source

As per the debug log of AWSInfo.m here you will get this error when you have not configured your defaultCognitoCredentialsProvider

As they will check

_cognitoCredentialsProvider = [AWSInfo defaultAWSInfo].defaultCognitoCredentialsProvider;

if they find _cognitoCredentialsProvider nil then you will get this error.

So configure defaultCognitoCredentialsProvider properly.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download