2016-12-01 31 views
0

Amazon SNSとiOS Appをセットアップして、SNSコンソール経由でプッシュ通知を送信し、iOSで受信します。それは適切に動作します。今Amazon SNSを使用してiOSからプッシュ通知を送信

は、私は別のデバイスへのデバイスからのプッシュ通知を送信しようとしているが、私は次のエラー取得しています:

-[AWSServiceInfo initWithInfoDictionary:checkRegion:] | Couldn't read credentials provider configurations from Info.plist . Please check your Info.plist if you are providing the SDK configuration values through 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 [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]); 
    }]; 

私は何が欠けているのかわかりません。彼らは、あなたはこのエラーを取得します_cognitoCredentialsProvider nilを見つけた場合、彼らは

_cognitoCredentialsProvider = [AWSInfo defaultAWSInfo].defaultCognitoCredentialsProvider; 

をチェックすると、あなたのdefaultCognitoCredentialsProvider

を設定していないときにこのエラーになりますAWSInfo.mhereのデバッグログを1として

答えて

1

defaultCognitoCredentialsProviderを正しく設定してください。

+0

エラーが「実行する権限がありません:SNS:リソースで公開:arn:aws:sns:us-west-2:XXXXXXXXXX:app/APNS_SANDBOX/XXXXXX <」 – sdadsad

+0

エラーは、この操作を実行するには、アクセス許可を確認する必要があります – Rajat

+0

どこでアクセス許可を確認できますか? – sdadsad

関連する問題