0

I'm having a problem after adding the AWS Amplify iOS SDK REST API to my project. I am unable to build my project due to 3 fatal compiler errors in one Amplify added file (*Client.swift under the generated-src folder), and I don't know what to do about them.

Everything was going very well with my iOS app after leveraging the Drop-in UI for authentication: I was able to sign in via my pre-existing Amazon Cognito User Pool. So, things were working.

Next step, I wanted to access a pre-existing DynamoDB table. It seems that the way to do this in an Amplify context is to add the REST API.

Following the steps in the link above, I knew Amplify was doing something I didn't want it to do by creating its own Cognito User Pool; I guess because I specified that I wanted to "Restrict API access" to authenticated users. What I expected is that I would restrict access on the basis of my already existing Cognito User Pool, not a new one.

Anyway, that is not my immediate problem.

After issuing the pod install --repo-update command, I added the new generated-src folder to my project. I thought it was curious that my awsconfiguration.json had not changed. At that point, as instructed, I attempted to build the project but was unable to do so due to those 3 errors.

/Users/xxxxx/Dev/iOS/xxxxxxxxxx/generated-src/xxxxxxxxxxxClient.swift:148:34: 
Cannot assign to property: 'endpoint' is a get-only property

/Users/xxxxx/Dev/iOS/xxxxxxxxxx/generated-src/xxxxxxxxxxxClient.swift:174:13: 
Value of type 'xxxxxxxxxxxClient' has no member 'invokeHTTPRequest'

/Users/xxxxx/Dev/iOS/xxxxxxxxxxx/generated-src/xxxxxxxxxxxClient.swift:195:13: 
Value of type 'xxxxxxxxxxxClient' has no member 'invokeHTTPRequest'

I cannot advance to the next step (thinking it might be the reason for those errors) because the Build Settings tab for my project doesn't show an Objective-C Bridging Header category. (Yes, I presume? Until built?)

Can someone help me out?

motivus
  • 253
  • 4
  • 15

1 Answers1

0

The good developers over at AWS Amplify's iOS SDK Github repo answered my question. As a result, they are updating the REST API guide to reflect the proper order of steps.

To summarize: you must add the Objective-C bridging header path to the Build Settings for the project. It was not obvious to me where to find this setting, but they posted a screenshot showing how to find it. Filtering without choosing those explicit settings did not turn it up in my case.

motivus
  • 253
  • 4
  • 15