dpa99c / cordova-plugin-firebasex

Cordova plugin for Google Firebase
MIT License
571 stars 468 forks source link

Could not compile on IOS - InAppMessagingDisplayResources.bundle missing #326

Closed sebastian-zarzycki-apzumi closed 4 years ago

sebastian-zarzycki-apzumi commented 4 years ago

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

iOS build issue:

sebastian-zarzycki-apzumi commented 4 years ago

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

jrista commented 4 years ago

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.

sebastian-zarzycki-apzumi commented 4 years ago

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.

jrista commented 4 years ago

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?

sebastian-zarzycki-apzumi commented 4 years ago

Clean and reset the whole project, I suppose?

jrista commented 4 years ago

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)

sebastian-zarzycki-apzumi commented 4 years ago

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.

jrista commented 4 years ago

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.

jrista commented 4 years ago

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.

dpa99c commented 4 years ago

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.

dpa99c commented 4 years ago

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 šŸ˜ž

jrista commented 4 years ago

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

jrista commented 4 years ago

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?

dpa99c commented 4 years ago

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.

jrista commented 4 years ago

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.

dpa99c commented 4 years ago

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

dpa99c commented 4 years ago

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

Javinator9889 commented 4 years ago

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?

dpa99c commented 4 years ago

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

Javinator9889 commented 4 years ago

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

Javinator9889 commented 4 years ago

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

dpa99c commented 4 years ago
cordova build ios --device --release
stat platforms/ios/<YourAppName>.xcarchive
Javinator9889 commented 4 years ago

@dpa99c It worked šŸ˜®

Thank you so much <3

nnimis commented 4 years ago

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

Javinator9889 commented 4 years ago

@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

sebastian-zarzycki-apzumi commented 4 years ago

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.

dpa99c commented 4 years ago

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.

nnimis commented 4 years ago

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

Javinator9889 commented 4 years ago

@nnimis what's the error you had?

dpa99c commented 4 years ago

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

sebastian-zarzycki-apzumi commented 4 years ago

Thank you for this detailed investigation, much appreciated.

patrickchoi commented 4 years ago

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.

dpa99c commented 4 years ago

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

sebastian-zarzycki-apzumi commented 4 years ago

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.

dpa99c commented 4 years ago

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.

sebastian-zarzycki-apzumi commented 4 years ago

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.

jrista commented 4 years ago

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

dpa99c commented 4 years ago

@jrista good idea - I will look into it

dpa99c commented 4 years ago

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
jrista commented 4 years ago

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

PatrickJung94 commented 4 years ago

@dpa99c I have added cordova plugin add cordova-plugin-firebasex@9.0.1-cli 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.

dpa99c commented 4 years ago

@PatrickJung94 cordova-plugin-firebasex@9.0.1-cli 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.

PatrickJung94 commented 4 years ago

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

dpa99c commented 4 years ago

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

PatrickJung94 commented 4 years ago

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

kennethtck commented 4 years ago

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

orenagiv commented 4 years ago

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 cordova-plugin-firebasex@9.0.1-cli;
jh-gh commented 4 years ago

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

l3ender commented 4 years ago

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!

PatrickJung94 commented 4 years ago

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