Search code examples
ioscordovaionic-frameworkcordova-plugins

The correct version of cocoapod and cordova-plugin-firebase-authentication for cordova-ios 5.1.1


I have an application running perfectly on Android with:

ionic 4 cordova 9 cordova-plugin-firebase-authentication 3.3.0

And now that I want to implement it on IOS, I get various errors.

The first one I got was that cordova-plugin-firebase-authentication version 3.3.0 was not compatible with cordova-ios 5.1.1 (default version of cordova 9). It asks me to use a version higher than 6 of cordova-ios, but that option is impossible for me since many of my plugins stop working with cordova 10 and cordova-ios 6.1.1.

So I tried to go down the version of cordova-plugin-firebase-authentication until finding the version that works with cordova-ios 5.1.1 and cordova 9.

But since version 3.2.0, I get the following error:

Failed to install 'cordova-plugin-firebase-authentication': Error: pod: Command failed with exit code 1 Error output:

at ChildProcess.whenDone (/…node_modules/cordova-common/src/superspawn.js:135:23)
at ChildProcess.emit (events.js:314:20)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
For more information about you at the moment, I have cocoapod 1.10.0 installed.

That is why I ask you, if any of you have been able to do this, with which version of cordova-plugin-firebase-authentication works well with cordova 9 and cordova-ios 5.1.1. And additionally, with which version of cocoapod, I will compile it well?

Cheers!


Solution

  • The problem lies in duplicating the same dependency with different versions. To solve this problem, you need to align your dependencies in the same version.

    The process of installing a plugin with Cordova carry out in 2 stages; The first is to install the plugin at the Cordova project level; this is to register the plugin and its variables in the package.json and config.xml file, the installation of the node packages and the download of the plugin in the plugins folder. Cordova disperses the plugin to the installed platforms in the second stage, speaking of IOS cocoa pods in charge of performing this action.

    So you can perform this process manually; when you run the installation of a plugin, and the error is in cocoapods, it means that it is in the second stage; you can go to the ios folder within platforms and execute:

    pod install --verbose
    

    You will get the same problem again but with a more detailed description of the error.

    In your case, it will be because your plugins refer to different versions of Firebase.

    To solve that, open the Podfile file, which is inside the ios folder, and it sets the same version in all dependencies that use Firebase.

    Later, run again

    pod install --verbose
    

    If this worked, go back to the plugins folder within the main project and in the configuration of each plugin, set the same value with which you obtained a successful installation with pod install.

    Now, if you want to save them in your project or ensure correct installation, you can use the variables:

    ANDROID_FIREBASE_AUTH_VERSION
    IOS_FIREBASE_AUTH_VERSION
    

    To set the value, you need from the Cordova.