Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

'AWSPredictionsPlugin' initializer is inaccessible due to 'internal' protection level, Amplify Swift

I added the Amplify package and now when I’m trying to initialize the predictions plugin is giving me an "’AWSPredictionsPlugin’ initializer is inaccessible due to ‘internal’ protection level" error. (I provisioned the backend resources prior to this too)

    struct FrenchAppApp: App {
   

    init(){
        configureAmplify()
    }
var body: some Scene { ...///
 

    func configureAmplify() {
    let apiPlugin = AWSAPIPlugin(modelRegistration: AmplifyModels())
    let dataStorePlugin = AWSDataStorePlugin(modelRegistration: AmplifyModels())
    let s3 = AWSS3StoragePlugin()
    let cognitoAuth = AWSCognitoAuthPlugin()
    let predictions = AWSPredictionsPlugin()
    
    do {
        try Amplify.add(plugin: apiPlugin)
        try Amplify.add(plugin: dataStorePlugin)
        try Amplify.add(plugin: s3)
        try Amplify.add(plugin: cognitoAuth)
        try Amplify.add(plugin: predictions)
        try Amplify.configure()
        print("Initialized Amplify");
    } catch {
        // simplified error handling
        print("Could not initialize Amplify: \(error)")
    }
}

I tried making the init public just for testing but it didn’t work, also tried this:

`class MyAWSPredictionsPlugin: AWSPredictionsPlugin {
    override init() {
        super.init()
    }
}`

and it didn’t work.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

There was a ticket issue on the repository two weeks ago, and has been fixed in the PR #3009, and the first release with the fix is the 2.11.6 version (2023-06-07).

So you need to update your current version.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading