invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.54k stars 2.19k forks source link

ios build fails with Instance ID package #3746

Closed leurs247 closed 4 years ago

leurs247 commented 4 years ago

When installing the instance ID package on IOS, I get the following errors (while building through XCODE, building through npx react-native run-ios just fails):

It's linked to this file: https://github.com/invertase/react-native-firebase/blob/master/packages/iid/ios/RNFBIid/RNFBIidModule.m

Environment:

I followed the instructions in the documentation. I added the package through npm and did a pod install. When I delete the package an re-run pod install, it works fine. I also have the analytics package installed. This works.

mikehardy commented 4 years ago

close Xcode npx react-native-clean-project then pod install and try again if building one way works and another way doesn't, there is likely some weird local caching going on. Xcode is pretty horrible that way

leurs247 commented 4 years ago

I did a clean-project, and installed the package again. Same error. I downgraded all packages to 7.1.0, still the same error.

Edit:

I want to build an app which should be able to receive FCM notifications. I want to have access to the device ID to send notifications to specific devices. In an old app I've built, I installed both the instance ID package and the cloud messaging package. I see in the documentation the following function messaging().getToken(). Is the instance ID necessary when I want to get the instance ID, or is this function (in the cloud messaging package) enough. I do not need the instance ID for anything else (I guess).

mikehardy commented 4 years ago

clone this and run this script: if it fails then we can reproduce https://github.com/mikehardy/rnfbdemo/blob/master/make-demo-v6.sh

As mentioned though, my local project is building fine with a yarn upgrade --latest as of around 18 hours ago

leurs247 commented 4 years ago

I've cloned the repo, but it fails at this line:

Cloning spec repo cocoapods from https://github.com/CocoaPods/Specs.git

I've stopped the execution and did cd ios && pod install && cd .., but I get the same problem (it stops at that line so the pods aren't installed). I do not get any errors, it just keeps executing (+15 minutes when I forced it to stop).

I'll try to install it in a bare project again, without any other libraries. I'll let you know asap.

Oh, and thanks for the fast replies! I really appriciate it!

PS: please check the edit in my previous comment. Maybe I don't need the instance ID package at all?

mikehardy commented 4 years ago

I think messaging.getToken() is enough, I believe it is specific to each app install? I get different tokens for the same firebase user on different devices (from react-native-device-info::getUniqueId())

I believe Instance ID in Firebase is a different concept and used more for securing content, not for targeting devices.

That said, failing to clone the CocoaPods git repo is a fundamental sort of infrastructure error. Something is wrong with your local machine or network for that not to work, or it's just large and timed out, unknown. That's not the sort of failure that has anything to do with react-native-firebase

leurs247 commented 4 years ago

I did a clean install, RN version 0.62.2. I only installed firebase/app and firebase/iid. App works perfectly, with iid I get the error again.

I started a new project with RN version 0.61.5 (the version I built the previous app in). Again, the same error.

I removed the firebase/iid package and it all works again. I also tried firebase/messaging and firebase/storage (the other packages I need), they work perfectly.

In which file does FIRInstanceID get declared? Because my error says it's undeclared. Maybe this file is missing in my installation?

Update:

It works, but only after I installed the firebase/messaging package first. It seems it's depending on this package? Is this correct? It's not documented in the docs. Anyway, it works smoothly now. Thanks for your help @mikehardy.

mikehardy commented 4 years ago

That is interesting and explains why my script and my project works. I know there is a connection between the messaging and instanceid packages but a hard dependency is not expressed no - @Ehesp / @Salakar are you guys aware of a hard dependency on IID in Messaging now? Should it be expressed in podspec+gradle or in package.json or similar?

RodolfoGS commented 4 years ago

I have the same error, I'm using:

RN: 0.61.5

leurs247 commented 4 years ago

@RodolfoGS installing @react-native-firebase/messaging will fix the issue I think. Delete iid, install messaging and install iid again.

RodolfoGS commented 4 years ago

@yesterday24 thanks, that worked. However I think that need to be fixed.

mikehardy commented 4 years ago

The correct way to handle it is to add a reaction on any workaround you find that works, and a reaction on the issue itself. They work as votes. Comments work as (unwanted) notification spam :-)

Salakar commented 4 years ago

This shouldn't be happening, I think this is from the recent iOS CoreOnly podspec change we did, Core used to include IID, guessing CoreOnly now no longer does; https://github.com/invertase/react-native-firebase/blob/master/packages/iid/RNFBIid.podspec

I've added this to the pipeline for next week.

mikehardy commented 4 years ago

I would say that not including IID by default is the intended outcome, for more privacy-concerned apps, so hopefully it's just a matter of making the dep more explicit for where it's needed and optional for the rest. Whichever way it goes let me know and I'll update my throwaway demo script (at least it's internal comments) for future explorers

Greeniemax commented 1 year ago

Ionic really SUCKS!!!