IOS Swift: using AWS SDK with xCode6 - error message

Using CocoaPods has added AWS libraries to my project.

The BridgingHeader.h file has been created:

#import "AWSCore.h" #import "AWSCognito.h" #import "AWSS3.h" 

In application build settings> Objective-C, BridgingHaders includes this BridgingHeader.h file.

Now in my code, when I use the credential initialization code:

 let credentialsProvider = AWSCognitoCredentialsProvider.credentialsWithRegionType( AWSRegionType.USEast1, accountId: "999999999999", identityPoolId: "us-east-1:ac328da6-63f3-4748-9b8f-999999999", unauthRoleArn: "arn:aws:iam::69644888888:role/Cognito_s3tutorialUnauth_DefaultRole", authRoleArn: "arn:aws:iam::69647777777:role/Cognito_s3tutorialAuth_DefaultRole") 

When compiling an error, I see:

credentialsWithRegionType is not available, use initWithRegionType ... instead

I also can not use initWithRegionType ... because then the error: AWSCognitoCredentialsProvider does not have a member named initWithRegionType

Surprisingly, I even see the signature and help of this in the right pane of my IDE: AWSCognitoCredentialsProvider.credentialsWithRegionType

What am I missing? Could this be a mix of version?

+1
ios xcode swift xcode6 aws-sdk
source share
1 answer

You may need to use this function as a constructor for Swift :

 let CognitoRegionType = AWSRegionType.Unknown // eg AWSRegionType.USEast1 let DefaultServiceRegionType = AWSRegionType.Unknown // eg AWSRegionType.USEast1 let CognitoIdentityPoolId = "YourCognitoIdentityPoolId" let S3BucketName = "YourS3BucketName" let credentialsProvider = AWSCognitoCredentialsProvider(regionType: CognitoRegionType, identityPoolId: CognitoIdentityPoolId) let configuration = AWSServiceConfiguration(region: DefaultServiceRegionType, credentialsProvider: credentialsProvider) AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = configuration 
+4
source share

All Articles