Reputation: 69
I was following the instructions from Amazon Web Services to set up AWS SDK following steps from the site below: http://docs.aws.amazon.com/mobile/sdkforios/developerguide/setup.html
I installed the AWS frameworks via cocoa pod. I get a problem when copying this code from the page into Appdelegate.swift. The defined constants of CognitoRegionType, CognitoIdentityPoolId, and DefaultServiceRegionType raise the error unresolved identifier.
Screenshot:
However the constant credentialsProvider seems to exist, so can anyone point out where I may be making a mistake? In some other examples I've looked at CognitoRegionType, CognitoIdentityPoolId, and DefaultServiceRegionType seem to be established constants upon importing AWSCore.
Upvotes: 1
Views: 1463
Reputation: 374
You can integrate like this in your didfinishlaunching method,I have converted my code in swift 3.0-
var credentialsProvider = AWSCognitoCredentialsProvider(regionType: AWSRegionType.usEast1, identityPoolId: "us-east-1:f53e36d5-****-****-****-bd42d4ca4489")
//Amazon Cognito Identity Pool ID
var serviceConfiguration = AWSServiceConfiguration(region: AWSRegionType.usEast1, credentialsProvider: credentialsProvider)
var analyticsConfiguration = AWSMobileAnalyticsConfiguration()
analyticsConfiguration.serviceConfiguration = serviceConfiguration
var analy = AWSMobileAnalytics.init(forAppId: "appid", configuration: analyticsConfiguration)
Upvotes: 1
Reputation: 847
Those are the things which you need to substitute based on your configuration from AWS Console. For e.g. If your Cognito Identity Pool is in US East 1 (N. Virginia), the CognitoRegionType will be .USEast1. The CognitoIdentityPoolId can be found in the Amazon Cognito Console. The service region is the region where all your resources lie.
Thanks, Rohan
Upvotes: 1