andrehtissot / cordova-plugin-fcm-with-dependecy-updated

Google FCM Push Notifications Cordova Plugin
MIT License
210 stars 277 forks source link

IOS Build Fails With Error 'Firebase.h' file not found #21

Closed tdakanalis closed 4 years ago

tdakanalis commented 4 years ago

I am trying to build the ios application via ionic cli by running the following command:

ionic cordova build ios --prod

but the build fails by reporting the following error:

FCMPlugin.m:7:9: fatal error: 'Firebase.h' file not found

import "Firebase.h"

Here is some information about my environment:

ionic (Ionic CLI) : 4.10.2 (/usr/local/lib/node_modules/ionic) Ionic Framework : @ionic/angular 5.0.3 @angular-devkit/build-angular : 0.900.3 @angular-devkit/schematics : 9.0.3 @angular/cli : 9.0.3 @ionic/angular-toolkit : 2.2.0

Cordova: cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1) Cordova Platforms : android 8.1.0, browser 6.0.0 ios 5.1.1 Cordova Plugins : cordova-plugin-fcm-with-dependecy-updated 4.4.0, cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 11 other plugins)

Could you please check and let me know how to overcome this issue?

andrehtissot commented 4 years ago

I'll check. Thank you for creating the issue.

andrehtissot commented 4 years ago

Is the project from which you got this issue available as open-source?

tdakanalis commented 4 years ago

Unfortunattely not. But I can provide you with any information you need regarding version, plugins etc.

andrehtissot commented 4 years ago

Would you provide the app's Podfile and Podfile.lock?

tdakanalis commented 4 years ago

Here are the contents of Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '11.0'

target 'demoproject' do
        project 'demoproject.xcodeproj'
        pod 'Firebase/Analytics', '~> 6.3.0'
        pod 'Firebase/Messaging', '~> 6.3.0'
end

However, I do not have a Podfile.lock.

andrehtissot commented 4 years ago

You should have a Podfile.lock, as it is created when the cocoapods dependencies are installed. If they are not installed, they won't be accessible by the plugin. Hence the error you saw.

As it is by by default on cordova, should also be on ionic. Interestingly, I saw this https://ionic.zendesk.com/hc/en-us/articles/360010049673-Managing-plugins-using-CocoaPods-in-Ionic-Appflow- Others also had the same issue, but far back in time: https://stackoverflow.com/questions/38584906/using-cocoapods-stops-ios-build-using-ionic-project

Would kindly try to force it?

touletan commented 4 years ago

same error here with phonegap build.

Is there a config to add to config.xml or an other plugin to install first?

Plugins/cordova-plugin-fcm-with-dependecy-updated/AppDelegate+FCMPlugin.m:5:9: fatal error: 'Firebase.h' file not found

import "Firebase.h"

    ^~~~~~~~~~~~

1 error generated.

tdakanalis commented 4 years ago

I forced the pod installation process and tried to build again but the following error appeared:

error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.

warning: AddressBook is deprecated. Consider migrating to Contacts instead. (in target 'xVlepsis' from project 'xVlepsis')
warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 7.0, but the range of supported deployment target versions is 8.0 to 13.4.99. (in target 'Protobuf' from project 'Pods')
* BUILD FAILED *

Here is the Podfile:

# DO NOT MODIFY -- auto-generated by Apache Cordova
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '11.0'

target 'demoproject' do
    project 'demoproject.xcodeproj'
    pod 'Firebase/Analytics', '~> 6.3.0'
    pod 'Firebase/Messaging', '~> 6.3.0'
end

Podfile.lock

PODS:
  - Firebase/Analytics (6.3.0):
    - Firebase/Core
  - Firebase/Core (6.3.0):
    - Firebase/CoreOnly
    - FirebaseAnalytics (= 6.0.2)
  - Firebase/CoreOnly (6.3.0):
    - FirebaseCore (= 6.0.3)
  - Firebase/Messaging (6.3.0):
    - Firebase/CoreOnly
    - FirebaseMessaging (~> 4.1.0)
  - FirebaseAnalytics (6.0.2):
    - FirebaseCore (~> 6.0)
    - FirebaseInstanceID (~> 4.2)
    - GoogleAppMeasurement (= 6.0.2)
    - GoogleUtilities/AppDelegateSwizzler (~> 6.0)
    - GoogleUtilities/MethodSwizzler (~> 6.0)
    - GoogleUtilities/Network (~> 6.0)
    - "GoogleUtilities/NSData+zlib (~> 6.0)"
    - nanopb (~> 0.3)
  - FirebaseAnalyticsInterop (1.5.0)
  - FirebaseCore (6.0.3):
    - GoogleUtilities/Environment (~> 6.0)
    - GoogleUtilities/Logger (~> 6.0)
  - FirebaseInstanceID (4.2.7):
    - FirebaseCore (~> 6.0)
    - GoogleUtilities/Environment (~> 6.0)
    - GoogleUtilities/UserDefaults (~> 6.0)
  - FirebaseMessaging (4.1.1):
    - FirebaseAnalyticsInterop (~> 1.1)
    - FirebaseCore (~> 6.0)
    - FirebaseInstanceID (~> 4.1)
    - GoogleUtilities/AppDelegateSwizzler (~> 6.2)
    - GoogleUtilities/Environment (~> 6.2)
    - GoogleUtilities/Reachability (~> 6.2)
    - GoogleUtilities/UserDefaults (~> 6.2)
    - Protobuf (~> 3.1)
  - GoogleAppMeasurement (6.0.2):
    - GoogleUtilities/AppDelegateSwizzler (~> 6.0)
    - GoogleUtilities/MethodSwizzler (~> 6.0)
    - GoogleUtilities/Network (~> 6.0)
    - "GoogleUtilities/NSData+zlib (~> 6.0)"
    - nanopb (~> 0.3)
  - GoogleUtilities/AppDelegateSwizzler (6.5.2):
    - GoogleUtilities/Environment
    - GoogleUtilities/Logger
    - GoogleUtilities/Network
  - GoogleUtilities/Environment (6.5.2)
  - GoogleUtilities/Logger (6.5.2):
    - GoogleUtilities/Environment
  - GoogleUtilities/MethodSwizzler (6.5.2):
    - GoogleUtilities/Logger
  - GoogleUtilities/Network (6.5.2):
    - GoogleUtilities/Logger
    - "GoogleUtilities/NSData+zlib"
    - GoogleUtilities/Reachability
  - "GoogleUtilities/NSData+zlib (6.5.2)"
  - GoogleUtilities/Reachability (6.5.2):
    - GoogleUtilities/Logger
  - GoogleUtilities/UserDefaults (6.5.2):
    - GoogleUtilities/Logger
  - nanopb (0.3.9011):
    - nanopb/decode (= 0.3.9011)
    - nanopb/encode (= 0.3.9011)
  - nanopb/decode (0.3.9011)
  - nanopb/encode (0.3.9011)
  - Protobuf (3.11.4)

DEPENDENCIES:
  - Firebase/Analytics (~> 6.3.0)
  - Firebase/Messaging (~> 6.3.0)

SPEC REPOS:
  https://github.com/CocoaPods/Specs.git:
    - Firebase
    - FirebaseAnalytics
    - FirebaseAnalyticsInterop
    - FirebaseCore
    - FirebaseInstanceID
    - FirebaseMessaging
    - GoogleAppMeasurement
    - GoogleUtilities
    - nanopb
    - Protobuf

SPEC CHECKSUMS:
  Firebase: 8432d732974498afd5987e9001a05f90f1a3d625
  FirebaseAnalytics: 470ddab7253b21ad5a40bebd4a9903d7ae19386a
  FirebaseAnalyticsInterop: 3f86269c38ae41f47afeb43ebf32a001f58fcdae
  FirebaseCore: 68f8a7f50cdae542715d4e86afa37c4067217dcb
  FirebaseInstanceID: ebd2ea79ee38db0cb5f5167b17a0d387e1cc7b6e
  FirebaseMessaging: 6bb0bdaf64c55fef7a219b7bb1e94e94a0855ced
  GoogleAppMeasurement: a35a645835bae31b6bdc0576396bc23908f12a22
  GoogleUtilities: ad0f3b691c67909d03a3327cc205222ab8f42e0e
  nanopb: 18003b5e52dab79db540fe93fe9579f399bd1ccd
  Protobuf: 176220c526ad8bd09ab1fb40a978eac3fef665f7

PODFILE CHECKSUM: ff6184ffdcefa897fb91c63eed3c2dec97222fb5

COCOAPODS: 1.9.1
andrehtissot commented 4 years ago

Would you, @touletan or @tdakanalis, consider creating a github repository of which I can clone and test it?

Eonio commented 4 years ago

I managed to solve this issue doing those steps: 1) npm uninstall -g cordova 2) npm install -g cordova@9 3) cordova platform rm ios 4) cordova plugin rm cordova-plugin-fcm-with-dependecy-updated 5) cordova plugin add cordova-plugin-fcm-with-dependecy-updated 6) open cordova-plugin-fcm-with-dependecy-updated.podspec and change these lines

spec.dependency 'Firebase/Analytics', '~> 6.3.0'
spec.dependency 'Firebase/Messaging', '~> 6.3.0' 
to
spec.dependency 'Firebase/Analytics’
spec.dependency 'Firebase/Messaging’

7) open plugin.xml and change these lines

<pod name="Firebase/Analytics" spec="~> 6.3.0" />
<pod name="Firebase/Messaging" spec="~> 6.3.0" />
To
<pod name="Firebase/Analytics" />
<pod name="Firebase/Messaging" />

8) cordova platform add ios@5

alaska88 commented 4 years ago

I've followed those steps, but I can't have it working... I'm with Ionic cli 4.8.0 cordova 9.00 cordova-ios 5.1.1

No way.... Or I get this firebase.h error, or "fatal: repository 'https://cdn.cocoapods.org/' not found" when trying to install ios 5.1.1

Could someone tell the combination of version to make it work , please '???? Thanks, and sorry for my english

xuanphu123 commented 4 years ago

pls help... same issue

Eonio commented 4 years ago

I've followed those steps, but I can't have it working... I'm with Ionic cli 4.8.0 cordova 9.00 cordova-ios 5.1.1

No way.... Or I get this firebase.h error, or "fatal: repository 'https://cdn.cocoapods.org/' not found" when trying to install ios 5.1.1

Could someone tell the combination of version to make it work , please '???? Thanks, and sorry for my english

Plz, send your ionic info in replay.

My ionic info is:

`Ionic:

Ionic CLI : 6.3.0 (/Users/eonio/.nvm/versions/node/v13.11.0/lib/node_modules/@ionic/cli) Ionic Framework : ionic-angular 3.9.9 @ionic/app-scripts : 3.2.4

Cordova:

Cordova CLI : 9.0.0 (cordova-lib@9.0.1) Cordova Platforms : android 8.1.0, ios 5.1.1 Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 33 other plugins)

Utility:

cordova-res : 0.11.0 native-run : 0.3.0

System:

Android SDK Tools : 26.1.1 (/Users/eonio/Library/Android/sdk) ios-sim : 8.0.2 NodeJS : v13.11.0 (/Users/eonio/.nvm/versions/node/v13.11.0/bin/node) npm : 6.13.7 OS : macOS Catalina Xcode : Xcode 11.4 Build version 11E146`

I would recommend you to use NVM then start a new life with a fresh new stack install. It's very easy to have as many dev stacks you need.

alaska88 commented 4 years ago

got it working. remove cordova add cordova@9.0.0 in your project directory, platforms/ios, run : 1) pod repo update --verbose 2) sudo gem install cocoapods add your firebase plugin add ios platform ( for me was 5.1.1 )

Enjoy !

escanda commented 4 years ago

It doesn't work in Phonegap Build which does a clean install on every build. There must be something missing in regard to the cocoa pods.

andrehtissot commented 4 years ago

The new cdn for cocoapods, as seem by some users, is failing.

andrehtissot commented 4 years ago

As other users had timeouts with the bloated github-hosted one, I'll experiment with a fallback approach.

andrehtissot commented 4 years ago

Please update the plugin with the new version.

Now the cordova-plugin-fcm-with-dependecy-updated plugin will keep the old github source for older cocoapods versions.

And will only change its source, when the minimal cocoapods that supports it is recognized (https://blog.cocoapods.org/CocoaPods-1.7.2/).

marinoszago commented 4 years ago

Hello guys I am still having issues here even with the latest version. The error is found inside FCMPlugin.m - Firebase.h not found

Can you help me?

alaska88 commented 4 years ago

update to cordoba 9, and follow my post, I've done 4 times since then, and all ok. My plugin version : "cordova-plugin-fcm-with-dependecy-updated": "4.5.1",

marinoszago commented 4 years ago

update to cordoba 9, and follow my post, I've done 4 times since then, and all ok. My plugin version : "cordova-plugin-fcm-with-dependecy-updated": "4.5.1", Sadly I was not able to fix it. A whole ffile is missing Firebase.h

marinoszago commented 4 years ago

Apparently I had to remove all instances of cordova ... it was using cordova 8. Thank you again it built successfully

MsPseudolus commented 4 years ago

In case this helps anyone: Have you installed anything using sudo? That will trigger this problem ^

I was trying all these suggested solutions, and then I finally destroyed my local copy, cloned the repo to local again and started from scratch. It dawned on me that I'd been running some installations as sudo as a quick "solution" to permissions complaints. When I took the time to change the owner from 'root' to my own user for all the directories being blocked by permissions during installation of any given package/plugin/library, everything worked like a charm. I didn't need to do any of the above solutions.

This might apply only to my lazy ass, but I share just in case it helps someone else ;-)

mateo2181 commented 3 years ago

Someone solved this problem with IONIC 5? I can't find a solution. I'm using:

carlo318 commented 1 year ago

Ho @mateo2181 did you manage to solve it? I have the same problem now with:

Thankyou