Thursday, December 1, 2022
HomeiOS DevelopmentIncluding AWS Amplify to iOS Swift app with a number of Targets...

Including AWS Amplify to iOS Swift app with a number of Targets doesn’t work


I am making an attempt so as to add amplify to an present iOS (Swift) software with a number of targets. After operating amplify init within the root of the venture, the cli offers the next suggestions:

Updating Xcode venture:
🚫 xcodeProject: Goal Fan app not discovered
— Restoration suggestion: Manually add Amplify information to your Xcode venture.

The amplify folder is created within the venture root, and I additionally see each awsconfiguration.json and amplifyconfiguration.json information.

I added the amplify packages to the venture and added Amplify.configure() to the AppDelegate as described within the aws docs on https://docs.amplify.aws/lib/project-setup/create-application/q/platform/ios/.

Once I run the applying, I see the next within the console:

Failed to search out Amplify configuration.
An error occurred establishing Amplify: ConfigurationError: Couldn’t load default amplifyconfiguration.json file
Restoration suggestion: Anticipated to search out the file, amplifyconfiguration.json within the app bundle at /Customers/xxx/Library/Developer/CoreSimulator/Gadgets/xxx/knowledge/Containers/Bundle/Utility/xxx/App.app, however it was not current. Both add amplifyconfiguration.json to your app’s “Copy Bundle Assets” buildphase, or invoke Amplify.configure() with a configuration object that you simply load from a customized path.

I assume that is due to the ‘not discovered’ error within the init step, however I would wish completely different configurations for the completely different targets. So I comply with the suggestion and invoke the configuration with a config object as prompt with the code I discovered right here

let apiConfig = APICategoryConfiguration(
plugins: ["awsAPIPlugin":
    [
        "myendpointname": [
            "endpointType": "GraphQL",
            "endpoint": "REPLACE",
            "region": "REPLACE",
            "authorizationType": "AMAZON_COGNITO_USER_POOLS"
        ]
    ]
])
let config = AmplifyConfiguration(api: apiConfig)
Amplify.configure(config)

However now I get:

No plugin discovered for configuration key awsAPIPlugin. Add a plugin for that key.

I can see within the goal settings that the plugin is added to the goal that I’m operating, so I get the sensation that that is additionally associated to the failed ultimate step within the amplify init the place amplify was not capable of finding the goal.

Plugins

My query is; how can I provoke amplify in a iOS venture with a number of targets?
Any assist is far appreciated.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments