升级到 XCode12.5 后不再构建 React Native App

问题描述

我之前在 xcode 11 中构建并在模拟器上运行的 React Native 应用程序。但是,自从升级到 xcode 12.5 后,我收到以下构建错误

Cannot initialize a parameter of type 'NSArray<id<RCTBridgeModule>> *' with an rvalue of type 'NSArray<Class>*'

Cannot initialize a parameter of type 'NSArray<Class> *' with an lvalue of type 'NSArray<id<RCTBridgeModule>> *__strong'

Cannot initialize a parameter of type 'NSArray<id<RCTBridgeModule>> *' with an lvalue of type 'NSArray<Class> *__strong'

这些错误来自我的项目中通过 cocoapods 的 react-core。

解决方法

更改 RCTCxxBridge.mm 624 行 代码块 Objective-C NSArray *)modules

到 代码块 Objective-C NSArray *)模块