React-native-firebase: Undefined symbols for architecture x86_64 "_OBJC_CLASS_$_RNFirebaseMessaging"

Created on 20 Feb 2018  路  8Comments  路  Source: invertase/react-native-firebase

Issue

Hi, I tried to update my RNFirebase with latest version but when I tried to rebuild it I got this 2 error

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_RNFirebaseMessaging", referenced from:
      objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I tried all steps to clean and reset the setup but still I got the error above. Before it was working but after I upgrade to the latest version it's not working anymore, did you encounter this error? I tried searching the solution here and test all suggest fix but still not working.

thanks,

Environment

  1. Application Target Platform:
    macOS

  2. Development Operating System:
    iOS

  3. Build Tools:

  4. React Native version:
    0.53.3

  5. RNFirebase Version:
    3.2.5

  6. Firebase Module:
    pod 'Firebase/Core'
    pod 'Firebase/Analytics'
    pod 'Firebase/Auth'
    pod 'Firebase/Messaging'
    pod 'Firebase/Database'
    pod 'Firebase/Storage'
    pod 'Firebase/Crash'

All 8 comments

sorry closing this topic, its now fixed

@eggybot what did you do to fix it? I'm having a similar issue

@eggybot Could you please follow up on how you fixed it? Running into similar problems

@eggybot having this issue as well
version:
react-native-firebase": "^4.2.0

how to fix this?

I was having this issue with release build and solved by adding this line to podfile:

  pod 'RNFirebase', :path => '../node_modules/react-native-firebase/ios'

Then pod install, clean project, and rebuild.
Actually I saw RNFirebase has already been installed during pod install even without explicitly specified in podfile. Debug builds completed with success, but somehow failed in release build. I guess react-native-firebase (mine is version 5.6.1 + React Native 0.61.5) doesn't work well with autolink.

Edit: This is incorrect. See my next comment for actual solution in my case.

react-native-firebase v5 works beautifully with autolink. It does not have problems with release mode

I suspect caching issues, and always suggest npx react-native-clean-project clean-project-auto followed by re-installing node_modules/pods and trying again.

For RNFBv5 + RN0.60+ this demonstration is all that is necessary for successful debug or release builds on android or iOS: https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh

@mikehardy After seeing your affirmation, I reviewed error messages and my setup and discovered my mistake. I apologize for blaming your library. Let me share my troubleshooting steps.

The problem, as the error message stated, was caused by AppDelegate failed to refer to RNFirebaseMessaging headers. After making sure my project linked to RNFirebase via Pods only, not via manual linking, I looked into RNFirebase target within Pods project. There I found that its header search paths don't include path to RNFirebase, only RNFirebase/Crashlytics was there. Now I found the root cause in Podfile:

  pod 'RNFirebase/Crashlytics', :path => '../node_modules/react-native-firebase/ios'

I didn't put pod 'RNFirebase' in hope of autolink doing it, but I put pod 'RNFirebase/Crashlytics' following the doc without knowledge of Cocoapod's subspec feature. As a result, only the subspec was installed. Removing the line from podfile allowed autolink to do its job and install the whole RNFirebase (including RNFirebase/Crashlytics) correctly.

Was this page helpful?
0 / 5 - 0 ratings