Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable IOS_USE_PRECOMPILED_FIRESTORE_POD does not work on 14.2.1-cli #759

Closed
5 tasks done
BlaineM-SeriouslyRAD opened this issue Sep 6, 2022 · 7 comments
Closed
5 tasks done

Comments

@BlaineM-SeriouslyRAD
Copy link

Bug report

CHECKLIST

  • I have read the issue reporting guidelines
  • I confirm this is a suspected bug or issue that will affect other users
  • I have reproduced the issue using the example project or provided the necessary information to reproduce the issue.
  • I have read the documentation thoroughly and it does not help solve my issue.
  • I have checked that no similar issues (open or closed) already exist.

Current behavior:

Using the 14.2.1-cli build, the pre-compiled Firestore pod is always used regardless of the variable IOS_USE_PRECOMPILED_FIRESTORE_POD.

The non-cli 14.2.1 version works fine.

Comparing plugin.xml between 14.2.1-cli and 14.2.1 reveals a number of differences including:

14.2.1-cli:
<pod name="FirebaseFirestore" git="https://github.com/invertase/firestore-ios-sdk-frameworks.git" tag="9.1.0"/>

14.2.1
<pod name="Firebase/Firestore" spec="9.1.0"/>

Expected behavior:
The variable IOS_USE_PRECOMPILED_FIRESTORE_POD should control whether the pre-compiled Firestore pod is used.

Steps to reproduce:
Add 14.2.1-cli into a project without specifying the variable (defaults to false).
Check the PodFile - it states:
pod 'FirebaseFirestore', :tag => '9.1.0', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git'

Environment information

  • Cordova CLI version
    • 11.0.0
  • Cordova platform version
    • ios 6.2.0
  • Dev machine OS and version, e.g.
    • OSX
      • Monterey 12.5.1
  • Node JS version
    • 16.17.0
@TiBz0u
Copy link

TiBz0u commented Sep 23, 2022

Hi @dpa99c, it seems the merge on plugin.xml fails.
The following line must be updated to point directly to the official pod version 9.1.0 .

@BlaineM-SeriouslyRAD Have you too problem with the precompiled version? At our side, the generated IPA file can't be install on our device. We have instant crash. If we use the official pod, no problem.

Thanks !

@BlaineM-SeriouslyRAD
Copy link
Author

@TiBz0u Due to this issue with the cli version, we're using the non-cli version with the official pod (i.e. not pre-compiled). Consequently, we haven't experienced an issue with instant crashing on devices.

@RobYed
Copy link

RobYed commented Oct 31, 2022

Can confirm it doesn't work. Tried it as a fix for the error in #735. I wrote a cordova hook to overwrite the Podfile. Similar to this one. Now it works.

However, would be great to see it fixed :)

@rex-iotum
Copy link

I wrote a cordova hook to overwrite the Podfile. Similar to #735 (comment). Now it works.

@RobYed can you share what you added in that after_prepare hook?

@RobYed
Copy link

RobYed commented Nov 9, 2022

@rex-iotum sure! It's very basic with a hard-coded version number, but might help:

module.exports = (context) => {
  // Make sure ios platform is part of build
  if (!context.opts.platforms.includes('ios')) {
    return;
  }

  const iosPlatformRoot = path.join(context.opts.projectRoot, 'platforms/ios');
  const podfilePath = path.join(iosPlatformRoot, 'Podfile');

  if (!fs.existsSync(podfilePath)) {
    console.log(
        `'${podfilePath}' does not exist. FirebaseFirestore fix skipped.`
    );
    return;
  }

  const preCompiledVersionString =
      "pod 'FirebaseFirestore', :tag => '9.1.0', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git'";

  let podfileContent = fs.readFileSync(podfilePath, 'utf-8');

  if (podfileContent.includes(preCompiledVersionString)) {
    podfileContent = podfileContent.replace(
        preCompiledVersionString,
        "pod 'FirebaseFirestore', '9.1.0'"
    );

    fs.writeFileSync(podfilePath, podfileContent, 'utf-8');

    console.log('Installing non pre-compiled FirebaseFirestore...');

    return execa('pod', ['install', '--verbose'], {
      cwd: iosPlatformRoot,
    });
  } else {
    console.log('Could not set non pre-compiled FirebaseFirestore');
  }
};

@TiBz0u
Copy link

TiBz0u commented Nov 9, 2022

Hi @RobYed.
Since release 14.2.0, the pre-compiled version is not the default anymore. As explained upper, there is a merge issue.
If you want the same behavior on the cli, instead of hook, juste adapt the plugin.xml to the right pod (as here)...

In all case, you'll need a fork before the fixing release.

EDIT : I just detect that the current cli_build branch has already been fixed with the PR you are waiting for.
#757

@dpa99c
Copy link
Owner

dpa99c commented Nov 23, 2022

Should be fixed in [email protected] which has just been released to npm

@dpa99c dpa99c closed this as completed Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants