{"action":"created","issue":{"url":"https://api.github.com/repos/aws/aws-sdk-ios/issues/448","repository_url":"https://api.github.com/repos/aws/aws-sdk-ios","labels_url":"https://api.github.com/repos/aws/aws-sdk-ios/issues/448/labels{/name}","comments_url":"https://api.github.com/repos/aws/aws-sdk-ios/issues/448/comments","events_url":"https://api.github.com/repos/aws/aws-sdk-ios/issues/448/events","html_url":"https://github.com/aws/aws-sdk-ios/issues/448","id":172844476,"number":448,"title":"AWSMobileAnalyticsService hard-coded to East1 Region / causes issues with user pools in other regions","user":{"login":"mnolanjr98","id":5250650,"avatar_url":"https://avatars.githubusercontent.com/u/5250650?v=3","gravatar_id":"","url":"https://api.github.com/users/mnolanjr98","html_url":"https://github.com/mnolanjr98","followers_url":"https://api.github.com/users/mnolanjr98/followers","following_url":"https://api.github.com/users/mnolanjr98/following{/other_user}","gists_url":"https://api.github.com/users/mnolanjr98/gists{/gist_id}","starred_url":"https://api.github.com/users/mnolanjr98/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnolanjr98/subscriptions","organizations_url":"https://api.github.com/users/mnolanjr98/orgs","repos_url":"https://api.github.com/users/mnolanjr98/repos","events_url":"https://api.github.com/users/mnolanjr98/events{/privacy}","received_events_url":"https://api.github.com/users/mnolanjr98/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/aws/aws-sdk-ios/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-08-24T01:25:02Z","updated_at":"2016-09-21T15:52:46Z","closed_at":"2016-09-20T06:19:19Z","body":"I have a managed user pool and federated identity pool in the West2 region.  When attempting to integrate both Cognito Identity Management and Mobile Analytics in the same application - I am only able to get one or the other.  The code listed below appropriately authenticates / registers users tied to pools in West 2.  However, when the analytics attempt to send, the AWSMobileAnalyticsService seems to try to configure the AWSCognitoIdentityManager to the East1 region.  If I rearrange the code below such that the credentialsProvider is not set to nil during instantiation of AWSServiceConfiguration, then analytics work but all actions regarding authentication and user creation stop working.  The Constants.* references are static constants for the actual configuration values.\r\n\r\n\r\nfunc application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {\r\n        // Override point for customization after application launch.\r\n        AWSLogger.defaultLogger().logLevel = AWSLogLevel.Verbose\r\n        \r\n        let DefaultServiceRegionType = AWSRegionType.USWest2\r\n        \r\n        let serviceConfiguration = AWSServiceConfiguration(\r\n            region: DefaultServiceRegionType,\r\n            credentialsProvider: nil)\r\n        \r\n        // Needed to support account registration\r\n        AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = serviceConfiguration\r\n        \r\n        let userPoolConfiguration = AWSCognitoIdentityUserPoolConfiguration(clientId: Constants.ClientIdAuth, clientSecret: Constants.ClientSecretAuth, poolId: Constants.PoolId)\r\n        \r\n        let poolKey = Constants.UserPoolName\r\n        \r\n        AWSCognitoIdentityUserPool.registerCognitoIdentityUserPoolWithConfiguration(serviceConfiguration, userPoolConfiguration: userPoolConfiguration, forKey: poolKey)\r\n        \r\n        let pool = AWSCognitoIdentityUserPool(forKey: poolKey)\r\n        pool.delegate = self\r\n        \r\n        let analytics = AWSMobileAnalytics(forAppId: Constants.AnalyticsAppId, identityPoolId: Constants.CognitoIdentityPoolId)\r\n        \r\n        return true\r\n    }"},"comment":{"url":"https://api.github.com/repos/aws/aws-sdk-ios/issues/comments/248655839","html_url":"https://github.com/aws/aws-sdk-ios/issues/448#issuecomment-248655839","issue_url":"https://api.github.com/repos/aws/aws-sdk-ios/issues/448","id":248655839,"user":{"login":"mnolanjr98","id":5250650,"avatar_url":"https://avatars.githubusercontent.com/u/5250650?v=3","gravatar_id":"","url":"https://api.github.com/users/mnolanjr98","html_url":"https://github.com/mnolanjr98","followers_url":"https://api.github.com/users/mnolanjr98/followers","following_url":"https://api.github.com/users/mnolanjr98/following{/other_user}","gists_url":"https://api.github.com/users/mnolanjr98/gists{/gist_id}","starred_url":"https://api.github.com/users/mnolanjr98/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnolanjr98/subscriptions","organizations_url":"https://api.github.com/users/mnolanjr98/orgs","repos_url":"https://api.github.com/users/mnolanjr98/repos","events_url":"https://api.github.com/users/mnolanjr98/events{/privacy}","received_events_url":"https://api.github.com/users/mnolanjr98/received_events","type":"User","site_admin":false},"created_at":"2016-09-21T15:52:46Z","updated_at":"2016-09-21T15:52:46Z","body":"This code won't compile, and get's into a chicken or the egg scenario (which comes first?).\r\n\r\nThe way you are initializing the instance of cognitoIdentity is well after you pass it into the constructor when creating the object assigned to userPoolServiceConfiguration.  So the first inclination is to move this to a point prior to initialization of the userPoolServiceConfiguration instance - but then you need to create the instance of AWSCongnitoIdentityUserPool assigned to the pool variable.  And this begins a total cascade of things to be shifted around.  And everything I've tried doesn't end up with both authentication and analytics working cohesively (when using User Pools - I haven't tried any other authentication provider).\r\n\r\nDoes AWS have a working sample with User Pools and Mobile Analytics working together?  Seeing they are part of the the cohesive Mobile Hub, I am assuming so.  It would be nice to see what that looks like."}}
{"actor":{"display_login":"mnolanjr98"}}