我目前正在探索AWS SNS,使用AWS iOS SDK集成AWS SNS。
该指南显示,我们必须使用Amazon Cognito进行身份验证,然后我们可以在AWS SNS中创建的应用程序中注册设备令牌。
我正在遵循的指南- https://medium.com/aws-activate-startup-blog/a-guide-to-amazon-simple-notification-service-mobile-push-self-registration-for-ios-a2502e8d5fbd#.mt7t7ed89
在我的项目中集成后-我得到这个错误:
Error
Domain=com.amazonaws.AWSSNSErrorDomain
Code=1 "The operation couldn’t be completed. (com.amazonaws.AWSSNSErrorDomain error 1.)"
UserInfo=0x12847e0
{
Type=Sender,
Message=User: arn:aws:sts::xxxxxxxxx:assumed-role/xxxxxxxxxxxxxxx/CognitoIdentityCredentials is not authorized to perform: SNS:CreatePlatformEndpoint on resource: arn:aws:sns:ap-south-1:xxxxxxxxx:app/xxxxxxxxxxxxxxxxxxxx,
__text=(
"n ",
"n ",
"n ",
"n "
),
Code=AuthorizationError}
所以请帮助我继续。
请告诉我如何在iOS中集成用于身份验证流的AWS api。
谢谢。
很抱歉给你带来麻烦。
请检查您是否已将SNS:CreatePlatformEndpoint添加到指定资源上的Auth和Unauth角色的策略中。
它应该看起来像…
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"sns:CreatePlatformEndpoint"
],
"Resource": [
"arn:aws:sns:ap-south-1:xxxxxxxxx:app/xxxxxxxxxxxxxxxxxxxx"
]
}
]
}