我已经将iOS SDK平台更新为14.5版.Xcode版本现在是12.5.更新后,我无法在设备上启动应用程序.编译器会抛出一个错误:

为'ForGemModuleNo'调用匹配函数

我试着重新安装pod ,但没用.你怎么能修好它?谢谢

enter image description here

推荐答案

我把所有建议的解决方案放在一起,得到了一个有效的版本.

Podfile

post_install do |installer|
    ## Fix for XCode 12.5
    find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm", "_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules", "_initializeModules:(NSArray<Class> *)modules")
    find_and_replace("../node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm", "RCTBridgeModuleNameForClass(strongModule))", "RCTBridgeModuleNameForClass(Class(strongModule)))")
  end
def find_and_replace(dir, findstr, replacestr)
  Dir[dir].each do |name|
      text = File.read(name)
      replace = text.gsub(findstr,replacestr)
      if text != replace
          puts "Fix: " + name
          File.open(name, "w") { |file| file.puts replace }
          STDOUT.flush
      end
  end
  Dir[dir + '*/'].each(&method(:find_and_replace))
end

之后,我发现了一个与Flipper有关的新错误:

Flipper-Folly/folly/synchronization/DistributedMutex-inl.h:1051:5: 'atomic_notify_one<unsigned long>' is unavailable

我使用Xcode throws 'atomic_notify_one' is unavailable的解决方案来解决这个问题.

# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
# use_flipper!()

并注释掉post_install do |installer|中的第# flipper_post_install(installer)

最后,重新安装pod,重新编译并运行项目.

React-native相关问答推荐

类似Snapchat的Reaction Native筛选器

React Native:如何以编程方式对图像进行黑白过滤?

useState 函数似乎阻止了 Animated.timing 事件?

不能总是在 Chrome 中设置 React Native 断点

React Navigation v5 中的初始路由参数?

如何获取 iOS 版本?

React native flexbox - 如何做 percentages || columns || responsive || grid etc

变量 window在react-native 中代表什么?

如何在react-native 中处理不同的屏幕尺寸?

使用 react-native 单击时如何更改图像和文本 colored颜色 ?

如何使用 InteractionManager.runAfterInteractions 使导航器过渡更快

ld:找不到-lFirebaseCore clang的库: error: linker command failed with exit code 1 (use -v to see invocation)

如何解决react-navigation 问题:Animated: `useNativeDriver` is not supported because the native animated module is missing.?

java.lang.ClassNotFoundException:在路径上找不到类.MainActivity:DexPathList react-native

Ipad 上的 React Native - 错误 - could not connect to development server

React Native - __DEV__ 未定义

居中图像 React Native 加载屏幕

如何在 react-native 中为在后台杀死的 android 应用程序保持状态

React本机IOS,当TextInput获得焦点时,按钮按下不注册

zIndex 不适用于react-native元素