react-native: release build fails on iOS: Undefined symbol: _OBJC_CLASS_$_FlipperClient

Description

My app works fine in debug Scheme, when switching build to “release” it fails with below errors:

Undefined symbol: OBJC_CLASS$_FKUserDefaultsPlugin Undefined symbol: OBJC_CLASS$_FlipperClient Undefined symbol: OBJC_CLASS$_FlipperKitLayoutPlugin Undefined symbol: OBJC_CLASS$_FlipperKitNetworkPlugin Undefined symbol: OBJC_CLASS$_FlipperKitReactPlugin Undefined symbol: OBJC_CLASS$_SKDescriptorMapper Undefined symbol: OBJC_CLASS$_SKIOSNetworkAdapter Linker command failed with exit code 1 (use -v to see invocation)

Screenshot 2023-09-10 at 3 53 05 PM (2)

React Native Version

0.72.3

Output of npx react-native info

info Fetching system and libraries information… System: OS: macOS 13.4.1 CPU: (10) arm64 Apple M2 Pro Memory: 671.23 MB / 16.00 GB Shell: version: “5.9” path: /bin/zsh Binaries: Node: version: 18.16.1 path: /usr/local/bin/node Yarn: version: 1.22.19 path: /usr/local/bin/yarn npm: version: 9.5.1 path: /usr/local/bin/npm Watchman: version: 2023.07.10.00 path: /opt/homebrew/bin/watchman Managers: CocoaPods: version: 1.12.1 path: /Users/saadalla/.rbenv/shims/pod SDKs: iOS SDK: Platforms: - DriverKit 22.4 - iOS 16.4 - macOS 13.3 - tvOS 16.4 - watchOS 9.4 Android SDK: Not Found IDEs: Android Studio: Not Found Xcode: version: 14.3.1/14E300c path: /usr/bin/xcodebuild Languages: Java: version: 11.0.19 path: /usr/bin/javac Ruby: version: 2.7.5 path: /Users/saadalla/.rbenv/shims/ruby npmPackages: “@react-native-community/cli”: Not Found react: installed: 18.2.0 wanted: 18.2.0 react-native: installed: 0.72.3 wanted: 0.72.3 react-native-macos: Not Found npmGlobalPackages: “react-native”: Not Found Android: hermesEnabled: true newArchEnabled: false iOS: hermesEnabled: true newArchEnabled: false

Steps to reproduce

I just followed the instructions from your official documentation.

Configure release scheme on xcode To configure your app to be built using the Release scheme, go to Product → Scheme → Edit Scheme. Select the Run tab in the sidebar, then set the Build Configuration dropdown to Release.

Screenshot 2023-09-10 at 4 07 16 PM (2)

Then click code build button

Snack, screenshot, or link to a repository

https://github.com/saadalla/RN-Linking-email-error.git

This problem exists for all my apps, this one can be used to reproduce

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Reactions: 7
  • Comments: 25 (7 by maintainers)

Most upvoted comments

For 0.72, you should re-install your pods with

PRODUCTION=1 bundle exec pod install

To remove Flipper from the Release build. We are aware that Flipper can’t be built in Release mode, but we are deprecating Flipper in 0.73 and it will be removed in 0.74.

We are working on a replacement for Flipper. In 0.73, it will still be experimental, hence why Flipper is only deprecated in 0.73. In 0.74 we will provide a debugger that should replace Flipper.

The only thing that worked to me was replace all the part from “post_install” on Podfile to the code below.

use_flipper!()

post_install do |installer| react_native_post_install(installer) installer.pods_project.build_configurations.each do |config| config.build_settings[“EXCLUDED_ARCHS[sdk=iphonesimulator*]”] = “arm64” end end

After that. Run the following commands in terminal on iOS folder.

pod deintegrate && pod install

Now clean build cache on Xcode and run the project.

Shortcut: CMD + SHIFT + K

I moved react-native-flipper in package.json from dependencies to devDependencies.

I managed to build the application and Archive it successfully 🥳

I used the full command PRODUCTION=1 NO_FLIPPER=1 bundle exec pod install

Flipper is going to be deprecated in React Native 0.73 and removed in React Native 0.74, so we will not incur in these problems anymore soon.

Unfortunately it produced 'RCTAppDelegate.h' file not found error

I tried with PRODUCTION=1 NO_FLIPPER=1 bundle exec pod install to avoid changing Podfile