0

I'm pretty new to iOS and 100% new to AWS. I'm building an app that needs to upload files. I downloaded the Amazon SDK through CocoaPods and used a bridging header to work with it in Swift.

Here's my header:

#ifndef ObjC_Bridging_Header_h
#define ObjC_Bridging_Header_h

#import "AWSCore.h"
#import "AWSS3.h"
#import "AWSDynamoDB.h"
#import "AWSSQS.h"
#import "AWSSNS.h"
#import "AWSCognito.h"

#endif /* ObjC_Bridging_Header_h */

I pointed to that file in my build settings to tell the compiler where it was.

Then I tried to configure the SDK in my AppDelegate.swift with this code:

var window: UIWindow?
let cognitoAccountId = "I'm not going to post this"
let cognitoIdentityPoolId = "I'm not going to post this"
let cognitoUnauthRoleArn = "I'm not going to post this"
let cognitoAuthRoleArn = "I'm not going to post this"

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    let credentialsProvider = AWSCognitoCredentialsProvider.credentialsWithRegionType(
        AWSRegionType.USEast1,
        accountId: cognitoAccountId,
        identityPoolId: cognitoIdentityPoolId,
        unauthRoleArn: cognitoUnauthRoleArn,
        authRoleArn: cognitoAuthRoleArn)
    let defaultServiceConfiguration = AWSServiceConfiguration(
        region: AWSRegionType.USEast1,
        credentialsProvider: credentialsProvider)
    AWSServiceManager.defaultServiceManager().setDefaultServiceConfiguration(defaultServiceConfiguration)


    return true
}

(And yes, I put in all of the ID strings etc. I just didn't want to post them)

Everything works except this last line: AWSServiceManager.defaultServiceManager().setDefaultServiceConfiguration(defaultServiceConfiguration)

It errors saying: "Value of type 'AWSServiceManager' has no member 'setDefaultServiceConfiguration'"

Why is everything working except for this line? What's wrong?

Isaac Wasserman
  • 1,461
  • 4
  • 19
  • 39

1 Answers1

0

AWSServiceManager has no setter for defaultServiceConfiguration.

Instead you have to use

AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = defaultServiceConfiguration

This'll work.

Varun
  • 759
  • 6
  • 12