cordova-plugin-firebasex: Could not compile on IOS - InAppMessagingDisplayResources.bundle missing

Bug Report

Current behavior:

When creating a prod build (Ionic), it crashes with:

error: Resource "/Users/rattkin/Library/Developer/Xcode/DerivedData/driverhood-fdggvwggwpvrhxbzlvxxdbhztdnu/Build/Products/Debug-iphonesimulator/FirebaseInAppMessaging/InAppMessagingDisplayResources.bundle" not found. Run 'pod install' to update the copy resources script.

The following build commands failed:
	PhaseScriptExecution [CP]\ Copy\ Pods\ Resources /Users/rattkin/Library/Developer/Xcode/DerivedData/driverhood-fdggvwggwpvrhxbzlvxxdbhztdnu/Build/Intermediates.noindex/driverhood.build/Debug-iphonesimulator/driverhood.build/Script-53D89128D701315A18804F16.sh

xcodebuild: Command failed with exit code 65

I did pod install in platforms/ios but it didn’t change anything. Also did pod repo update.

Looks like a problem with Firebase/InAppMessaging pod?

Expected behavior: It should compile properly.

Steps to reproduce: ionic cordova build ios --prod

Environment information

  • Cordova CLI version 9.0.0 (cordova-lib@9.0.1)
  • Cordova platform version
Installed platforms:
  android 8.1.0
  browser 6.0.0
  ios 5.1.1
Available platforms: 
  electron ^1.0.0
  osx ^5.0.0
  windows ^7.0.0
  • Plugins & versions installed in project (including this plugin)
call-number 0.0.2 "Cordova Call Number Plugin"
cordova-plugin-actionsheet 2.3.3 "ActionSheet"
cordova-plugin-androidx 1.0.2 "cordova-plugin-androidx"
cordova-plugin-androidx-adapter 1.1.0 "cordova-plugin-androidx-adapter"
cordova-plugin-camera 4.1.0 "Camera"
cordova-plugin-device 2.0.3 "Device"
cordova-plugin-dialogs 2.0.2 "Notification"
cordova-plugin-facebook4 6.3.0 "Facebook Connect"
cordova-plugin-firebasex 8.1.1 "Google Firebase Plugin"
cordova-plugin-geolocation 4.0.2 "Geolocation"
cordova-plugin-googleplus 8.4.0 "Google SignIn"
cordova-plugin-inappbrowser 3.2.0 "InAppBrowser"
cordova-plugin-ionic-webview 4.1.3 "cordova-plugin-ionic-webview"
cordova-plugin-market 1.2.0 "Market"
cordova-plugin-network-information 2.0.2 "Network Information"
cordova-plugin-sign-in-with-apple 0.0.1 "cordova-plugin-sign-in-with-apple"
cordova-plugin-splashscreen 5.0.3 "Splashscreen"
cordova-plugin-statusbar 2.4.3 "StatusBar"
cordova-plugin-whitelist 1.3.4 "Whitelist"
cordova-plugin-x-socialsharing 5.6.4 "SocialSharing"
es6-promise-plugin 4.2.2 "Promise"
ionic-plugin-deeplinks 1.0.20 "Ionic Deeplink Plugin"
uk.co.workingedge.phonegap.plugin.launchnavigator 5.0.4 "Launch Navigator"
  • Dev machine OS and version, e.g. mac OS 10.15.3 Catalina

iOS build issue:

  • Node JS version v10.18.1
  • XCode version 11.3.1

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 12
  • Comments: 74 (16 by maintainers)

Commits related to this issue

Most upvoted comments

OK, so as discussed there is now a cli_build branch from which the problematic Firebase SDK components has been removed. You can install directly from the branch or there’s an associated parallel NPM release:

cordova plugin add cordova-plugin-firebasex@9.0.1-cli

This is now outlined in the main documentation so to help anyone who is unaware of the CLI build issues.

There is a corresponding patch release from the master branch which re-adds the Inapp Messaging components and is intended for building from Xcode until such time as a new cordova-ios version fixes the CLI build issues:

    cordova plugin add cordova-plugin-firebasex@9.0.1

@PatrickJung94 , try running cmd ionic cordova plugin rm cordova-plugin-firebasex --force

Then, make sure there is no “your_project_name/plugin/cordova-plugin-firebasex” folder. If still exist, I just deleted it manually.

Then, run ionic cordova plugin add cordova-plugin-firebasex@9.0.1-cli.

After that, run cmd npm install @ionic-native/firebase-x.

After that, check using cmd ionic cordova plugin. It should list cordova-plugin-firebasex 9.0.1-cli "Google Firebase Plugin".

You should also check “your_project_name/plugin/cordova-plugin-firebasex/package.json” as 9.0.1-cli will be referenced all over…which is what you want. Lastly, check “your_project_name/package.json” and look for cordova-plugin-firebasex": "^9.0.1-cli.

Then, try to build your app again with sudo ionic cordova build ios.

TL;DR: if building using the CLI, pin version 8.0.1 until such time as a patch release can be done to fix this issue with 8.1.x If building with Xcode, you should be fine to update to latest v8.1.1

Protip: don’t pin it like so: "cordova-plugin-firebasex": "^9.1.1-cli" as it will default to the non-cli. Use it directly. "cordova-plugin-firebasex": "9.1.1-cli"

Seems obvious, but I’ve lost some time today scratching my head, why it still throws the old error.

The specific cause of this issue is outlined in https://github.com/apache/cordova-ios/issues/659:

The CONFIGURATION_BUILD_DIR argument set by Cordova overrides the pod-specific value required to make the build succeed making it fail with when pods contain a specific folder structure such as the Firebase Inapp Messaging pod.

So for example, running cordova build ios in my environment runs the xcodebuild command from platforms/ios/ with these arguments:

xcodebuild -workspace FirebaseTest.xcworkspace -scheme FirebaseTest -configuration Debug -sdk iphonesimulator -destination platform="iOS Simulator,name=iPhone 11 Pro Max" build CONFIGURATION_BUILD_DIR=/Users/dave/Documents/projects/cordova-plugin-firebasex-test/platforms/ios/build/emulator SHARED_PRECOMPS_DIR=/Users/dave/Documents/projects/cordova-plugin-firebasex-test/platforms/ios/build/sharedpch

If I manually run that command but remove the CONFIGURATION_BUILD_DIR argument, the build succeeds:

xcodebuild -workspace FirebaseTest.xcworkspace -scheme FirebaseTest -configuration Debug -sdk iphonesimulator -destination platform="iOS Simulator,name=iPhone 11 Pro Max" build SHARED_PRECOMPS_DIR=/Users/dave/Documents/projects/cordova-plugin-firebasex-test/platforms/ios/build/sharedpch

So this is bug in the current versions of Cordova in how it handles these pods. There is currently no way of telling the Cordova CLI to omit the CONFIGURATION_BUILD_DIR argument, so the only options iare to build directly in Xcode or invoke the xcodebuild command manually (grabbing it from the failed output of cordova build ios) and omit the CONFIGURATION_BUILD_DIR argument

Damn, I forgot GoogleTagManager iOS component was added by PR #318.

It is indeed a systemic issue with the cordova-ios platform in adding support for Cocoapods; the CLI build system does not fully support the build configuration required for some pods such as these (as outlined in https://github.com/apache/cordova-ios/issues/659).

I (and others) are now using GTM via this plugin in production, so removing this component for iOS as well (though it fixes the CLI build issue) is not an option.

I need to have a rethink on my strategy to manage this: building in Xcode works just fine when the GTM & Inapp Messaging SDK components are included - it’s just Cordova CLI builds that are the problem and that is due to a problem within the Cordova CLI build process on iOS.

Therefore, I propose to create a new branch of this repo - cli_build - which specifically removes GTM & Inapp Messaging SDK components for both platforms (even though iOS is the problem and Android builds fine with the CLI, I don’t want to create cross-platform inconsistencies). This branch will be otherwise the same as master and will be maintained in parallel but npm releases will be off the master branch so will contain GTM & Inapp Messaging SDK components. Therefore, if you want to build with the Cordova CLI you’ll need to reference the branch directly in your project:

cordova plugin add https://github.com/dpa99c/cordova-plugin-firebasex#cli_build

If and when a new version of cordova-ios resolves the underlying build issue caused when certain pods such as these are included, those using CLI builds can then switch back to the master branch.

This is the best way I can think to manage this problem - after all it is a problem caused by the Cordova CLI build process and building with Xcode works fine - so I don’t wish to restrict the plugin functionality for those able to build from Xcode for the benefit of those who cannot.

cordova build ios --device --release
stat platforms/ios/<YourAppName>.xcarchive

@hcassar93 I have seen similar problems. I suggest that you try upgrading your cocoapods installation to the pre-release version (see https://stackoverflow.com/questions/63646607/xcode-12-using-firebase-pods-lexical-or-preprocessor-issue-pb-h-file-not-fou/63648164#63648164). That fixed it for me.

Anyone having this issue please add following plugin with same version: cordova-plugin-androidx-adapter 1.1.1 cordova-plugin-androidx 1.0.2 cordova-plugin-firebasex 9.0.1-cli

cordova-plugin-androidx and cordova-plugin-androidx-adapter are needed for this plugin.

cordova platform remove ios; cordova platform add ios@latest; cordova plugin remove cordova-plugin-firebasex; cordova plugin add cordova-plugin-firebasex@9.0.1-cli;

Thank you @orenagiv this worked for me.

@dpa99c Hi, it looks like InAppMessaging and GoogleTagManager were merged back into 9.0.3-cli branch from master in https://github.com/dpa99c/cordova-plugin-firebasex/commit/b21213f3cb4d461f87980694fb2a2869ba979996. As a result we started to get this error again.

I had similar problems and solved them by switching to version 9.0.1-cli.

However, this caused the IOS build time to increase by over 400% (compared to version 6.1.0 of the plugin). I verified a similar increase when compiling the sample app with these two versions.

I noticed a comment above from @patrickchoi suggesting that the jump in build times came with between versions 8.0.1 and 8.1.0. I tried downgrading to 8.0.1 and indeed this builds successfully and dramatically faster. For now I will go with this version (8.0.1) as I don’t need any of the features in later releases and the increased build times are a big issue, especially in our CI environment where we use relatively underpowered mac minis.

Does anybody know if there is any way to mitigate the build time slowdown in the latest versions of the plugin? I realise this is probably not an issue with the plugin itself … more with Firebase sdk components (??) Is there any way to tweak this at build time (and ideally drive this from a setting/script/cli)?

@dpa99c Is there any chance you could publish the cli versions to an npm tag? I don’t know how flexible npm tags are…I’ve used alpha and beta myself, but I think technically, they can be anything. It would be really nice if you could still publish the cli version to your official npm for this module, just under a different tag. That would hopefully allow you to use the same version with perhaps an alternative suffix (i.e. 8.2.0-cli vs. 8.2.0), publish the cli one under a cli tag in npm, and then we can simply change the version we use in our package.json to add -cli to the end of the version.

@nnimis if you follow the conversation, you can see that you can compile by pinning the firebasex plugin to v8.0.1

In addition, it’s a work in progress (opened less than a day ago) and it will be fixed probably when possible. I encourage you to read the entire issue in order to fix possible issues