Here is the error I get:
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.
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": [
"*"
]
}
]
}
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.
EDIT
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
}
Both are called successively in the AppDelegate in the application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?)
function.
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.