NO_FLIPPER导致RN编译失败

问题描述

Xcode构建RN报错:

Undefined symbols for architecture arm64:
  "_OBJC_CLASS_$_FlipperClient", referenced from:
      objc-class-ref in libreact-native-flipper.a(FlipperReactNativeJavaScriptPluginManager.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

问题分析

NO_FLIPPER没有设置成功导致react-native-flipper编译时没有被排除
React Native 0.71.1 当 NO_FLIPPER=1 时排除 react-native-flipper 以防止 iOS 构建失败

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
 # because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
 #
 # To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
 # ```js
 # module.exports = {
 #   dependencies: {
 #     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
 # ```

问题解决

通过设置NO_FLIPPER=1把Flipper从pods中排除后再构建RN
Disable Flipper for iOS

NO_FLIPPER=1 pod install --project-directory=ios