Capacitor 4 upgrade failure

Hello,

We have a relatively simple iOS app which we have migrated from Capacitor 3 → 4, however when we try to build/run the project we get the following error: “Cannot find type PluginConfig in scope”, and highlights the following line of code in CAPInstanceConfiguration:

@objc public func getPluginConfig(_ pluginId: String) → PluginConfig {
if let cfg = (pluginConfigurations as? JSObject)?[keyPath: KeyPath(“(pluginId)”)] as? JSObject {
return PluginConfig(config: cfg)
}
return PluginConfig(config: JSObject())
}

Any ideas ?

How did you go about doing the migration? Was it using the migrate CLI command, VS Code extension, or manually following the guide? What versions of Capacitor do you have installed in your project (core, android, iOS, any plugins)?

This is the first time I’ve seen this error, so just trying to gather some additional information.

Thanks for the quick response. First we tried using the CLI upgrade command (which gave that error), and then tried following the manual instructions (same error).

We have these installed

"@capacitor-community/http": "^1.4.1",
"@capacitor/android": "^3.5.1",
"@capacitor/app": "1.1.1",
"@capacitor/core": "3.5.1",
"@capacitor/haptics": "1.1.4",
"@capacitor/ios": "^3.5.1",
"@capacitor/keyboard": "1.2.2",
"@capacitor/splash-screen": "^1.2.2",
"@capacitor/status-bar": "1.0.8",

Got the same issue.
In my case I rm -r node_modules and npm i; ionic build; npx cap sync ios again to solve the problem.

Before that I tried to set Pods’ Targets to iOS 13. Not sure if that is required.

1 Like

Just ionic build and npx cap sync ios fixed the issue