在我的iOS应用配置亚马逊移动分析和AWS Cognito提出了一些异常IAM链接 [英] Configuring Amazon Mobile Analytics and AWS Cognito in my iOS app raise some exception linked with IAM

查看:2057
本文介绍了在我的iOS应用配置亚马逊移动分析和AWS Cognito提出了一些异常IAM链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是错误我得到:

AWSiOSSDKv2 [Error] AWSMobileAnalyticsDefaultDeliveryClient.m line:282 
| -[AWSMobileAnalyticsDefaultDeliveryClient submitEvents:andUpdatePolicies:] 
| Unable to successfully deliver events to server. Response code: 0. 
Error Message:
Error Domain=com.amazonaws.AWSCognitoIdentityErrorDomain Code=6 
The operation couldn’t be completed.

我AuthRole在IAM与以下策略:

I have AuthRole in IAM with the following policy:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "mobileanalytics:PutEvents",
        "cognito-sync:*"
      ],
      "Resource": [
        "*"
      ]
    }
  ]
}

还有一未授权的角色:

And one Unauth role:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "mobileanalytics:PutEvents",
        "cognito-sync:*"
      ],
      "Resource": [
        "*"
      ]
    }
  ]
}

的字符串提及IAM在 cognito-identity.amazonaws.com:aud 的条件相匹配是什么在我的应用程序中声明。

The string mention in IAM under cognito-identity.amazonaws.com:aud the conditions matches what is declared in my app.

我不明白问题出在哪里。

I don't get where the problem is.

修改

的设置code(雨燕)。

The setup code (Swift).

private func _configureAWSServiceManager() {
    let credentialsProvider = AWSCognitoCredentialsProvider(
        regionType: Config().amazonRegionType,
        identityPoolId: Config().amazonCognitoIdentityPool)
    let configuration =
    AWSServiceConfiguration(region: Config().amazonRegionType,
        credentialsProvider: credentialsProvider)
    AWSServiceManager.defaultServiceManager().defaultServiceConfiguration =
    configuration
}

private func _configureMobileAnalytics() {
    let mobileAnalyticsConfiguration = AWSMobileAnalyticsConfiguration()
    mobileAnalyticsConfiguration.transmitOnWAN = true;

    let analytics = AWSMobileAnalytics(
        forAppId: Config().amazonMobileAnalyticsAppId,
        configuration: mobileAnalyticsConfiguration,
        completionBlock: nil)
    _analytics = analytics
}

无论是在AppDelegate中的应用程序依次称为(应用程序:UIApplication的,didFinishLaunchingWithOptions launchOptions:[NSObject的:AnyObject]?)。功能

编辑/解决方案:接连检查情况,建立Cognito身份池的步骤做创建角色,但这个角色是不是在未经身份验证的作用 ...愚蠢的事情,因为总是与正确的管理在AWS上。

EDIT / Solution: after another check it happens that a step of the creation of Cognito Identity Pool did create a role but this role was not assigned in unauthenticated role... Stupid thing, as always with the right management on AWS.

推荐答案

的问题与CognitoIdentity,不MobileAnalytics。根据商务部,AWSCognitoIdentityErrorDomain code = 6用于 InvalidIdentityPoolConfiguration

The problem is related to CognitoIdentity, not MobileAnalytics. According to the doc, AWSCognitoIdentityErrorDomain Code=6 means InvalidIdentityPoolConfiguration.

身份池中没有为给定的认证类型(AUTH /未授权)关联的角色,或者如果AssumeRole失败。

"identity pool has no role associated for the given auth type (auth/unauth) or if the AssumeRole fails."

我的建议是登录到AWS Web控制台 - > Cognito,仔细检查你的身份池的设置。并确保RegionType匹配您在Web控制台创建的(屏幕右上角):CognitoIdentity目前的支撑美国东1 欧盟 - 西-1

My Suggestion would be login to AWS Web Console -> Cognito, double check the settings of your Identity Pool. and Make sure the RegionType matched the one you created in the web console (upper right of the screen): CognitoIdentity current support us-east-1 and eu-west-1.

有关MobileAnalytics,请确保您设置configuration.serviceConfiguration.regionType为美国东1 只。

For MobileAnalytics, make sure you set configuration.serviceConfiguration.regionType to us-east-1 only.

http://docs.aws.amazon.com/AWSiOSSDK/latest/Constants/AWSCognitoIdentityErrorType.html

这篇关于在我的iOS应用配置亚马逊移动分析和AWS Cognito提出了一些异常IAM链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆