Search code examples
iosreact-nativeexpococoapodsreact-native-firebase

React Native Firebase Analytics: Undefined symbols for architecture x86_64


I'm trying to build an iOS development build of my Expo project for an iOS simulator. I'm developing the app using the managed workflow with a custom development client.

My project depends on a suite of React Native Firebase libraries, including Firestore and Auth. Recently, I also added Analytics by executing expo install @react-native-firebase/analytics. When I tried to build the project with expo run:ios, I got the following error.

❌  Undefined symbols for architecture x86_64
┌─ Symbol: _OBJC_CLASS_$_FIRAnalytics
└─ Referenced from: objc-class-ref in RNFBAnalyticsModule.o


❌  ld: symbol(s) not found for architecture x86_64



❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)

    Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the my_project_name editor. (in target 'my_project_name' from project 'my_project_name')

This is the link to the minimum, reproducible example on github. Please run expo run:ios after expo install.

  • Tried to clear caches by following instructions on expo doc.
  • Deleted the ios directory.
  • Manually installed pods by running pod install inside the ios directory.

None of the above solutions worked. Am I missing something here?


Solution

  • It turned out that my setting for a config plugin (that writes configurations for native projects) was wrong.

    firebase-ios-sdk requires the usage of frameworks. To specify this on a managed Expo project, you need to install a config plugin called expo-build-properties and edit the plugin property of app.json like following:

    [
      "expo-build-properties",
      {
        "ios": {
          "useFrameworks": "static"
        }
      }
    ]
    

    In my original code, instead of static, I specified dynamic, which was causing the error.