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

Created on 4 Mar 2020  ·  71Comments  ·  Source: dpa99c/cordova-plugin-firebasex

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

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
Firebase SDK bug build issue ios

Most helpful comment

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 [email protected]

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 [email protected]

All 71 comments

Works when I revert cordova-plugin-firebasex version to 8.0.1. In-app messaging support in recent releases must have broken something.

Also encountering the same issue. Tried running pod repo update and pod install in the cocoapods preparation phase of my CI build as well, to no avail:

      - run:
          name: Ionic - Prepare Cordova iOS & CocoaPods Dependencies
          command: |
            ionic cordova prepare ios --confirm --no-build
            cd platforms/ios/
            pod dependencies
            ionic cordova plugin rm cordova-plugin-firebasex
            ionic cordova plugin add cordova-plugin-firebasex
            ionic cordova prepare ios --confirm --no-build
            pod repo update
            pod install

Getting this plugin working is, as you can see above, a major chore. CocoaPods' pod dependencies cannot be run unless the plugin is present, however the initial install of the plugin fails because CocoaPods is not installed properly. So one must first prep the cordova platform and install the plugin (in a failed state), do pod dependencies, then remove the plugin, add it back, re-prepare the platform, and now it seems also pod repo update and then run pod install...

There has got to be an easier way to get this plugin working... O-o

In the full error report:

PhaseScriptExecution [CP]\ Copy\ Pods\ Resources /Users/distiller/Library/Developer/Xcode/DerivedData/WICShopper-bvrgbdzwowyexyasjjjdflehrghx/Build/Intermediates.noindex/WICShopper.build/Release-iphonesimulator/WICShopper.build/Script-4C9A577E4E098CD9C9C43025.sh (in target 'WICShopper' from project 'WICShopper')
    cd /Users/distiller/project/platforms/ios
    /bin/sh -c /Users/distiller/Library/Developer/Xcode/DerivedData/WICShopper-bvrgbdzwowyexyasjjjdflehrghx/Build/Intermediates.noindex/WICShopper.build/Release-iphonesimulator/WICShopper.build/Script-4C9A577E4E098CD9C9C43025.sh
error: Resource "/Users/distiller/Library/Developer/Xcode/DerivedData/WICShopper-bvrgbdzwowyexyasjjjdflehrghx/Build/Products/Release-iphonesimulator/FirebaseInAppMessaging/InAppMessagingDisplayResources.bundle" not found. Run 'pod install' to update the copy resources script.

Running the recommended command, pod install, does not seem to have any effect. I've looked for the specified .bundle file, and I cannot find it anywhere. The plugin does seem to have broken in the latest release.

The bundle is there, in the platforms/ios/build directory, but it's "flat", instead of sitting in a subdirectory called FirebaseMessaging or something like that. It's like either the referencing script has the wrong path, or the bundle isn't landing in the right spot.

I've tried to move back to version 8.0.1, but I am still having build problems. The current build error is this, which occurs whether I run pod install or not:

PhaseScriptExecution [CP]\ Check\ Pods\ Manifest.lock /Users/distiller/Library/Developer/Xcode/DerivedData/WICShopper-bvrgbdzwowyexyasjjjdflehrghx/Build/Intermediates.noindex/WICShopper.build/Release-iphonesimulator/WICShopper.build/Script-6CDB74AC9D91AFB94F3486DA.sh (in target 'WICShopper' from project 'WICShopper')
    cd /Users/distiller/project/platforms/ios
    /bin/sh -c /Users/distiller/Library/Developer/Xcode/DerivedData/WICShopper-bvrgbdzwowyexyasjjjdflehrghx/Build/Intermediates.noindex/WICShopper.build/Release-iphonesimulator/WICShopper.build/Script-6CDB74AC9D91AFB94F3486DA.sh
diff: /Podfile.lock: No such file or directory
diff: /Manifest.lock: No such file or directory
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.

This issue has left us dead in the water and unable to progress with our development. Any chance we could get some insight from the plugin authors?

Clean and reset the whole project, I suppose?

Every build in our CI is from a clean slate. We pull the repo, then run the necessary ionic/cordova commands to prepare, install plugins, etc. from scratch. We don't check in our platforms or plugins directories (one of the reasons we've stuck with Cordova, rather than move to Capacitor, as Capacitor usually requires that you fiddle with low-level native code and you end up having to check it all in...bleh. :P)

Are you using the modern build system for XCode, or legacy build system? Do you still have cordova-plugin-cocoapodsx in your project? It was dropped some time ago and maybe it clashes with something, if it's still left.

This is a relatively new project, started late last year with Ionic 4 and Cordova 9. It doe snot use cocoapodsx.

The project worked fine until last week, then it suddenly broke. We've been developing and deploying builds for several months, until maybe mid-week last week. The only change appears to be FirebaseX.

I have now tried several previous versions of the plugin. I restored our CI build script to what it used to be, before I started fiddling with it to try and resolve this issue. We originally started with v7.0.1 of this plugin back in November last year. I've tried 7.0.1, 7.0.2, 8.0.0 and 8.0.1. All of these versions result in this same error:

CompileC /Users/distiller/Library/Developer/Xcode/DerivedData/WICShopper-bvrgbdzwowyexyasjjjdflehrghx/Build/Intermediates.noindex/WICShopper.build/Release-iphonesimulator/WICShopper.build/Objects-normal/x86_64/FirebasePlugin.o /Users/distiller/project/platforms/ios/WICShopper/Plugins/cordova-plugin-firebasex/FirebasePlugin.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'WICShopper' from project 'WICShopper')
    cd /Users/distiller/project/platforms/ios
    export LANG=en_US.US-ASCII
    /Applications/Xcode-11.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -target x86_64-apple-ios11.0-simulator -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=c99 -fobjc-arc -fmodules -gmodules -fmodules-cache-path=/Users/distiller/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/distiller/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wno-trigraphs -fpascal-strings -Os -Wno-missing-field-initializers -Wno-missing-prototypes -Wunreachable-code -Wno-implicit-atomic-properties -Wno-objc-interface-ivars -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode-11.3.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.2.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -g -fvisibility=hidden -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -fobjc-abi-version=2 -fobjc-legacy-dispatch -iquote /Users/distiller/Library/Developer/Xcode/DerivedData/WICShopper-bvrgbdzwowyexyasjjjdflehrghx/Build/Intermediates.noindex/WICShopper.build/Release-iphonesimulator/WICShopper.build/WICShopper-generated-files.hmap -I/Users/distiller/Library/Developer/Xcode/DerivedData/WICShopper-bvrgbdzwowyexyasjjjdflehrghx/Build/Intermediates.noindex/WICShopper.build/Release-iphonesimulator/WICShopper.build/WICShopper-own-target-headers.hmap -I/Users/distiller/Library/Developer/Xcode/DerivedData/WICShopper-bvrgbdzwowyexyasjjjdflehrghx/Build/Intermediates.noindex/WICShopper.build/Release-iphonesimulator/WICShopper.build/WICShopper-all-target-headers.hmap -iquote /Users/distiller/Library/Developer/Xcode/DerivedData/WICShopper-bvrgbdzwowyexyasjjjdflehrghx/Build/Intermediates.noindex/WICShopper.build/Release-iphonesimulator/WICShopper.build/WICShopper-project-headers.hmap -I/Users/distiller/project/platforms/ios/build/emulator/include -I/Users/distiller/project/platforms/ios/build/emulator/usr/local/lib/include -I/Users/distiller/Library/Developer/Xcode/DerivedData/WICShopper-bvrgbdzwowyexyasjjjdflehrghx/Build/Intermediates.noindex/UninstalledProducts/include -I/Users/distiller/Library/Developer/Xcode/DerivedData/WICShopper-bvrgbdzwowyexyasjjjdflehrghx/Build/Intermediates.noindex/UninstalledProducts/iphonesimulator/include -I/Users/distiller/project/platforms/ios/build/emulator -I/Users/distiller/Library/Developer/Xcode/DerivedData/WICShopper-bvrgbdzwowyexyasjjjdflehrghx/Build/Intermediates.noindex/WICShopper.build/Release-iphonesimulator/WICShopper.build/DerivedSources-normal/x86_64 -I/Users/distiller/Library/Developer/Xcode/DerivedData/WICShopper-bvrgbdzwowyexyasjjjdflehrghx/Build/Intermediates.noindex/WICShopper.build/Release-iphonesimulator/WICShopper.build/DerivedSources/x86_64 -I/Users/distiller/Library/Developer/Xcode/DerivedData/WICShopper-bvrgbdzwowyexyasjjjdflehrghx/Build/Intermediates.noindex/WICShopper.build/Release-iphonesimulator/WICShopper.build/DerivedSources -F/Users/distiller/project/platforms/ios/build/emulator -include /Users/distiller/project/platforms/ios/build/sharedpch/SharedPrecompiledHeaders/749132040139485224/WICShopper-Prefix.pch -MMD -MT dependencies -MF /Users/distiller/Library/Developer/Xcode/DerivedData/WICShopper-bvrgbdzwowyexyasjjjdflehrghx/Build/Intermediates.noindex/WICShopper.build/Release-iphonesimulator/WICShopper.build/Objects-normal/x86_64/FirebasePlugin.d --serialize-diagnostics /Users/distiller/Library/Developer/Xcode/DerivedData/WICShopper-bvrgbdzwowyexyasjjjdflehrghx/Build/Intermediates.noindex/WICShopper.build/Release-iphonesimulator/WICShopper.build/Objects-normal/x86_64/FirebasePlugin.dia -c /Users/distiller/project/platforms/ios/WICShopper/Plugins/cordova-plugin-firebasex/FirebasePlugin.m -o /Users/distiller/Library/Developer/Xcode/DerivedData/WICShopper-bvrgbdzwowyexyasjjjdflehrghx/Build/Intermediates.noindex/WICShopper.build/Release-iphonesimulator/WICShopper.build/Objects-normal/x86_64/FirebasePlugin.o
/Users/distiller/project/platforms/ios/WICShopper/Plugins/cordova-plugin-firebasex/FirebasePlugin.m:4:9: fatal error: 'Firebase.h' file not found
#import "Firebase.h"
        ^~~~~~~~~~~~

If I run pod install, I get the error I previously reported, about Podfile.lock and Manifest.lock missing.

We are completely dead in the water here.

Upon investigation, it seems this error only occurs when building from the CLI (via the xcodebuild tool) - building from Xcode works fine (hence - since I always build in Xcode - this issue was missed).
For comparison here's the (failed) CLI build console output) vs the (successful) Xcode build console output.

As to why this error should occur, I currently have no idea.
The Inapp Messaging component was added by merging PR #312 and on the face of it is a simple addition - just the addition of a Firebase SDK component via its Cocoapods reference with no associated plugin code changes.
The CLI build fails because InAppMessagingDisplayResources.bundle was not found. This seems be be an implicit component of the Firebase SDK (vs something which is explicitly specified by this plugin).
Hence there doesn't seem to be much that can be done from the plugin to resolve this short of removing the Inapp Messaging component of the Firebase SDK from this plugin, which of course will lose that associated functionality.

In the meantime, the workaround is to build from Xcode rather than the CLI.

I tried updating the podspecs to reference the latest v6.18.0 release of the Firebase SDK for iOS but the issue still occurs when building from the CLI 😞

We don't have the option of building with XCode in our CI (Continuous Integration) build. It has to be command line. So that cannot be the recommended solution. Both old versions, and the current version, are currently broken. I don't know if that is because of a Firebase SDK update that has broken all versions prior to 8.1.1, or something else...but we use Firebase Analytics and Cloud Messaging, and currently our development is halted because of the changes here.

Is there some way to get the previous version, 8.0.1, working without running into either of the errors I've posted above? We don't need In-App Messaging, but it doesn't seem as though 8.0.1 builds at the command line any better than 8.1.1...

I tried updating the podspecs to reference the latest v6.18.0 release of the Firebase SDK for iOS but the issue still occurs when building from the CLI 😞

Would it be possible to reference a previous version? Any chance we could get an 8.0.2 that references the same version of the SDK that worked prior to 8.1.1?

v8.0.1 builds fine from the CLI - see this console output from my build.

It's the addition of the Inapp Messaging component that has caused the issue with CLI builds on iOS.

Ok. I had to find and update all version references to the firebasex plugin and set them to 8.0.1, and explicitly reference 8.0.1 when I reinstall the plugin, after uninstalling it (because the first install of the plugin fails due to pods not being installed, but pods can't be installed until the plugin is installed...), before updating the pods, to get everything to work. Once I had all the version numbers configured explicitly to 8.0.1 in all places, the build finally started to work.

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

It seems this issue is not specific to this plugin or to the particular version of the Inapp Messaging SDK component it references:
I am able to reproduce the issue with cordova-plugin-firebase-inappmessaging (which pulls in Firebase/InAppMessagingDisplay v6.3.0) using the following commands:

cordova create test && cd test
cordova plugin add cordova-plugin-firebase-inappmessaging
cordova platform add ios
cordova build ios

which (as this console output demonstrates) fails with the same error:

error: Resource "/Users/dave/Library/Developer/Xcode/DerivedData/HelloCordova-gvppvcmxenjfsnfvmssmvbuwhnay/Build/Products/Debug-iphonesimulator/FirebaseInAppMessagingDisplay/InAppMessagingDisplayResources.bundle" not found. Run 'pod install' to update the copy resources script.

as with this plugin, building in Xcode is successful

I have pinned version 8.0.1 but I still have errors - the problem is that FirebaseCore.h is not found (as mentioned in #330)
Looks like it is a problem with headers or something similar. The command I am running is:

xcodebuild -j "$(sysctl -n hw.ncpu)" \
           -project "platforms/ios/app.xcodeproj" \
           -scheme "app-scheme" \
           -configuration Release clean archive \
           -archivePath "platforms/ios/app.xcarchive" \
           PROVISIONING_PROFILE="$uuid_dbg" \
           CODE_SIGN_IDENTITY="$identity_dbg"

Any hint on how can I solve this problem?

@Javinator9889 looks like you are invoking xcodebuild directly?

Rather than via the Cordova CLI which generates something like:

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/@scratch/cordova-plugin-firebasex-test/platforms/ios/build/emulator SHARED_PRECOMPS_DIR=/Users/dave/Documents/projects/@scratch/cordova-plugin-firebasex-test/platforms/ios/build/sharedpch

Direct invocation of xcodebuild isn't something I can directly support in the context of this plugin as there's too many potential variations.

All I can say is that the example project builds fine with v8.0.1 via the Cordova CLI and fine with v8.1.1 via Xcode, so use that as a working reference.

@dpa99c I will have a look at using Cordova CLI - thanks in advance :)

@dpa99c I'm getting into Cordova for the first time - I've been working on a project for a time.

Would you mind if I ask you to guide me on how to create an xcarchive using Cordova CLI?

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

@dpa99c It worked 😮

Thank you so much <3

Sorry for poking! I reckon that we can work around it by using XCode, but is there a fix planned for this issue? Builds with XCode takes a way more than using CLI

@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

I think we have to wait for either new version of Firebase SDK, or for new version of cordova / cordova-ios. Cocoapods support is still a bit shaky.

At this stage I have no idea what's causing the issue so no fix is planned until I can determine the cause - as shown here this error is not specific to this plugin.
Any help in finding the cause would make resolution of the issue faster.

Thank you all, no big rush, just wanted to know if there is a fix planned to be implemented at any point.
@Javinator9889 the downgrade didn't worked in my case, sorry

@nnimis what's the error you had?

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

Thank you for this detailed investigation, much appreciated.

8.01 fixes it on native-run (Ionic 3) and dramatically reduces the build time from 8.1.0 (over 12 minutes) back to just 1-2 mins.

v9.0.0 has now been published which resolves this issue by remove the Inapp Messaging SDK components from this plugin

Didn't help much, unfortunately. The error now (in 9.0.0) switched to:

error: Resource "Build/Products/Debug-iphonesimulator/GoogleTagManager/TagManagerResources.bundle" not found. Run 'pod install' to update the copy resources script.

Seems like a systemic issue.

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.

That seems like a reasonable solution, thank you. Hopefully cordova-ios can release new version soon, because problems are piling up on iOS side recently.

@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.

@jrista good idea - I will look into it

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 [email protected]

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 [email protected]

Thanks, @dpa99c! Glad the alternative version suffix worked! Thats awesome!

@dpa99c I have added cordova plugin add [email protected] to my project and it worked the first time building for ios. However if I run the build command, ionic cordova build ios , again I get the error again that InAppMessagingDisplayResources.bundle" is not found.

@PatrickJung94 [email protected] does not contain any references to the Inapp Messaging SDK component so I would speculate that you have a reference to a non-CLI version somewhere in your config which is causing that version to be pulled in instead.

Check your project configuration files and also plugins/cordova-plugin-firebasex/plugin.xml to see what version is actually present in your project.

@dpa99c I changed <plugin id="cordova-plugin-firebasex" version="9.0.1" to <plugin id="cordova-plugin-firebasex" version="9.0.1-cli" in plugins/cordova-plugin-firebasex/plugin.xml and I am still getting the error after building. Could there be another reference I could look for?

Even when removing platforms/ios, plugins and node_modules and reinstalling with npm install and building again with ionic cordova build ios the problem persists.

@PatrickJung94 check package.json also. I would do a recursive text search of all project files to make sure you haven't missed any.

@dpa99c package.json has following entry: "cordova-plugin-firebasex": "^9.0.1-cli" though in package-lock.json I have:

"cordova-plugin-firebasex": {
      "version": "9.0.1",
      "resolved": "https://registry.npmjs.org/cordova-plugin-firebasex/-/cordova-plugin-firebasex-9.0.1.tgz",
      "integrity": "sha512-VUFJjd7PLeeHQ6ZIbtjxGhTCUtKmWB4vhzl8QaJ0rUcr6rwhjE8FYg6n68MODaKlbSU1emlB2QcV8vvL354UCQ==",
      "requires": {
        "plist": "^3.0.1",
        "xcode": "^2.0.0",
        "xml-js": "^1.6.11"
      }
    }

Deleting the lock file and running npm install again does not update the newly generate lock file.

@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 [email protected].

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.

Hey,

Just FYI, I had the same issue and managed to resolve by following @kennethtck instructions + by completely removing the ios platform > re-adding it > removing the plugin > re-adding it:

cordova platform remove ios;
cordova platform add ios@latest;
cordova plugin remove cordova-plugin-firebasex;
cordova plugin add [email protected];

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)?

We have a Cordova app but are also building a native watch app for our iOS project. We faced a lot of issues trying to use Cordova CLI to build iOS when wanting to bundle in the watch app (due to CLI limitations for handling both iOS and watch apps during build/archive process--specifically for signing, if I recall). Because of this, we need to manually perform iOS app+watch builds using xcodebuild.

I ran into the same build errors as this issue describes but have finally gotten it to work using the following.

cd platforms/ios

xcodebuild -workspace PROJECTNAME.xcworkspace -scheme PROJECTNAME -configuration Release -destination generic/platform=iOS -archivePath PROJECTNAME.xcarchive archive SHARED_PRECOMPS_DIR=build/sharedpch ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=YES

# exportOptions.plist was generated using XCode (archive app)
cp ../../build/ios/exportOptions.plist .

xcodebuild -exportArchive -archivePath PROJECTNAME.xcarchive -exportOptionsPlist exportOptions.plist -exportPath build/device

We are using v8.0.1 of this plugin. I faced some other issues when trying to use 9.0.1-cli (error: Build input file cannot be found: gRPCCertificates-Cpp.bundle/gRPCCertificates-Cpp).

I know our situation is probably unique but maybe this can help others in the future. Thanks!

@kennethtck I have forgotten to tell you that my colleague had fixed our problem following your steps. Thank you for the provided steps!

@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.

@dpa99c, @maxtacco, I do too.

`cd [MYPATH]/platforms/ios
/bin/sh -c [MYPATH]/Library/Developer/Xcode/DerivedData/[APPNAME]-aanowkqndskebrfkxmvdfhcnksye/Build/Intermediates.noindex/[APPNAME].build/Debug-iphonesimulator/[APPNAME].build/Script-2DD7BADC130A1BDEF45FCB72.sh
error: Resource "[MYPATH]/Library/Developer/Xcode/DerivedData/[APPNAME]-aanowkqndskebrfkxmvdfhcnksye/Build/Products/Debug-iphonesimulator/FirebaseInAppMessaging/InAppMessagingDisplayResources.bundle" not found. Run 'pod install' to update the copy resources script.

* BUILD FAILED *

The following build commands failed:
PhaseScriptExecution [CP] Copy Pods Resources [MYPATH]/Library/Developer/Xcode/DerivedData/[APPNAME]-aanowkqndskebrfkxmvdfhcnksye/Build/Intermediates.noindex/[APPNAME].build/Debug-iphonesimulator/[APPNAME].build/Script-2DD7BADC130A1BDEF45FCB72.sh
(1 failure)
xcodebuild: Command failed with exit code 65`

I am using a cordova webpack plugin and I prefer to use CLI.

Cheers!

* edit *

I did @orenagiv 's trick and it worked. Looks like backtracking to [email protected] did it form me. Thanks!

@jh-gh Did you get it to compile faster? For me, on my Macbook Air 2012 it takes 23 mins with CLI (cordova run ios) to start!! And it always seem to rebuild all.

Cheers.

@Phrensoua No, I have not found any way to make it compile faster on the 9.X stream. I am still staying with 8.0.1 for now as that version still builds in a reasonable amount of time for ios whereas the 9.0.1-cli version takes 4 times as long to build (haven't tried any later 9.X versions).

I noticed a comment above from @patrickchoi suggesting that the jump in build times came with between 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.

Excuse me @jh-gh did you solve the problem just removing the plugin and installing it again in this way?

cordova plugin add [email protected]

cordova platform remove ios;
cordova platform add ios@latest;
cordova plugin remove cordova-plugin-firebasex;
cordova plugin add [email protected];

Thank you @orenagiv this worked for me.

@jh-gh, thank you for your reply. On my side, I have resolved to execute into Xcode for now. It doesn't rebuild all every time at least...

Cheers

I noticed a comment above from @patrickchoi suggesting that the jump in build times came with between 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.

Excuse me @jh-gh did you solve the problem just removing the plugin and installing it again in this way?

cordova plugin add [email protected]

@ilclaudio I updated the dependency version in package.json and did a clean build (rm node_modules, npm install, rm platforms/plugins, (ionic) cordova build ios).

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)?

I got build problem with 9.1.1 also but build with 9.1.1-cli was successful. These versions have same build time problem. It tooks maybe 15-20 minutes. So i downgraded 8.0.1 and built in 2-3 minutes. Thank you for test and 8.0.1 tip.

@orenagiv
THNKS!
ionic cordova plugin add [email protected]

it worked perfect, compilation time is the only problem currently

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.

Is there a difference between building by using CLI cordova run ios --device and by Xcode ?

@sboudouk yes, currently building a pod that contains subfolders (such as Google Tag Manager or Firebase Inappmessaging) fails using the Cordova CLI (as documented here) whereas it works fine when building in Xcode, hence the need for a -cli branch of this plugin.

Is it possible to provide package with the "latest-cli" tag?

Hi

I have a big issue with this plugin on ios when compiling. I didnt want to start a new thread as i dont think its an issue with the plugin but with the pods library. It creates a build error saying disk full on various stages of the build. I am using a remote mac server and their support cant help me apart from creating a new server which i could do but i feel it maybe the same problem. I think its a ram disk full issue as this pod library is massive and makes the compile time take alot longer. I have searched online for something to fix this issue cleaning up the xcode build etc but i am still unable to create this build. Is there someone who can direct me to a solution to why its giving this error and what i can do to fix it? The build works fine and fast without this plugin

Here is an example
error: accessing build database
"/Users/user915171/Library/Developer/Xcode/DerivedData/Astra-albjvigcqvqixkbzncjokuhaaees/Build/Intermediates.noindex/XCBuildData/build.db": database or disk is full

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.

Hey

Having similar issues building with the cordova cli. However I have not been able to resolve them by changing to any -cli version of the plugin. Or by downgrading to 8.0.1 which was previously working for me.

My builds always fails with the following message regardless of which version of the plugin I use now. If i remove the plugin completely the build succeeds.

Not sure how these pods are still sneaking into my build even when using the -cli plugin or the 8.0.1 plugin. Will post if I find a solution. If anyone has seen this issue please let me know.


While building module 'nanopb' imported from /Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:
In file included from :1:
/Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:13:9: error: double-quoted include "pb.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]

import "pb.h"

    ^~~~~~
    <pb.h>

/Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:14:9: error: double-quoted include "pb_common.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]

import "pb_common.h"

    ^~~~~~~~~~~~~
    <pb_common.h>

While building module 'nanopb' imported from /Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:
In file included from :1:
In file included from /Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:14:
/Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/nanopb/pb_common.h:8:10: error: double-quoted include "pb.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]

include "pb.h"

     ^~~~~~
     <pb.h>

While building module 'nanopb' imported from /Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:
In file included from :1:
/Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:15:9: error: double-quoted include "pb_decode.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]

import "pb_decode.h"

    ^~~~~~~~~~~~~
    <pb_decode.h>

While building module 'nanopb' imported from /Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:
In file included from :1:
In file included from /Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:15:
/Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/nanopb/pb_decode.h:9:10: error: double-quoted include "pb.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]

include "pb.h"

     ^~~~~~
     <pb.h>

While building module 'nanopb' imported from /Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:
In file included from :1:
/Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:16:9: error: double-quoted include "pb_encode.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]

import "pb_encode.h"

    ^~~~~~~~~~~~~
    <pb_encode.h>

While building module 'nanopb' imported from /Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:
In file included from :1:
In file included from /Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:16:
/Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/nanopb/pb_encode.h:9:10: error: double-quoted include "pb.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]

include "pb.h"

     ^~~~~~
     <pb.h>

While building module 'nanopb' imported from /Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:
In file included from :1:
/Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:17:9: error: double-quoted include "pb.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]

import "pb.h"

    ^~~~~~
    <pb.h>

/Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:18:9: error: double-quoted include "pb_decode.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]

import "pb_decode.h"

    ^~~~~~~~~~~~~
    <pb_decode.h>

/Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:19:9: error: double-quoted include "pb_common.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]

import "pb_common.h"

    ^~~~~~~~~~~~~
    <pb_common.h>

/Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:20:9: error: double-quoted include "pb.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]

import "pb.h"

    ^~~~~~
    <pb.h>

/Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:21:9: error: double-quoted include "pb_encode.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]

import "pb_encode.h"

    ^~~~~~~~~~~~~
    <pb_encode.h>

/Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/Target Support Files/nanopb/nanopb-umbrella.h:22:9: error: double-quoted include "pb_common.h" in framework header, expected angle-bracketed instead [-Werror,-Wquoted-include-in-framework-header]

import "pb_common.h"

    ^~~~~~~~~~~~~
    <pb_common.h>

13 errors generated.
In file included from /Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.c:20:
/Users/haydencassar/Code/AppTemplate/frontend/platforms/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.h:22:10: fatal error: could not build module 'nanopb'

include

~~~~^
14 errors generated.

* ARCHIVE FAILED *

The following build commands failed:
CompileC /Users/haydencassar/Library/Developer/Xcode/DerivedData/Vita_Plan-adyddjnjkyhpbddfhgtvyhypkbaq/Build/Intermediates.noindex/ArchiveIntermediates/Vita Plan/IntermediateBuildFilesPath/Pods.build/Debug-iphoneos/GoogleDataTransport.build/Objects-normal/armv7/cct.nanopb.o GoogleDataTransport/GoogleDataTransport/GDTCCTLibrary/Protogen/nanopb/cct.nanopb.c normal armv7 c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
xcodebuild: Command failed with exit code 65
[ERROR] An error occurred while running subprocess cordova.

    cordova build ios --debug --device --buildConfig ./platforms/ios/build.json exited with exit code 65.

@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.

@jh-gh Thanks so much. Really appreciate your help. Fixed it for me too.

Pinning the plugin version at 8.0.1 works for me too. Building from the CLI and CI.

Was this page helpful?
0 / 5 - 0 ratings