重建 React Native 项目时 IOS 的构建失败

Build failed for IOS when rebuilding React Native project

我正在通过 yarn add 模块用 Xcode 13/cocoapods 1.15 一个一个地重建我的 React Native 0.67.4 项目。添加几个模块后,运行 pod installnpx react-native run-ins 使用 IOS 15 模拟器进行测试。在添加了几个模块并成功 pod install 后出现以下错误。我感觉到该错误与 pod 相关,但不知道如何解决。这是错误

/Users/macair/Documents/code/js/xyz_app6/node_modules/react-native/React/CoreModules/RCTActionSheetManager.mm:98:35: error: no member named 'cancelButtonTintColor' in 'JS::NativeActionSheetManager::SpecShowActionSheetWithOptionsOptions'
      [RCTConvert UIColor:options.cancelButtonTintColor() ? @(*options.cancelButtonTintColor()) : nil];
                          ~~~~~~~ ^
/Users/macair/Documents/code/js/xyz_app6/node_modules/react-native/React/CoreModules/RCTActionSheetManager.mm:98:72: error: no member named 'cancelButtonTintColor' in 'JS::NativeActionSheetManager::SpecShowActionSheetWithOptionsOptions'
      [RCTConvert UIColor:options.cancelButtonTintColor() ? @(*options.cancelButtonTintColor()) : nil];
                                                               ~~~~~~~ ^
2 errors generated.

......

** BUILD FAILED **


The following build commands failed:
    CompileC /Users/macair/Library/Developer/Xcode/DerivedData/xyz_app6-drkombcrczieyyfirepznaljzqwr/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-CoreModules.build/Objects-normal/x86_64/RCTActionSheetManager.o /Users/macair/Documents/code/js/xyz_app6/node_modules/react-native/React/CoreModules/RCTActionSheetManager.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'React-CoreModules' from project 'Pods')
(1 failure)

执行以下步骤:

  1. 删除 node_modules 个文件夹
  2. npm installyarn install
  3. 删除 pods 文件夹和 Podfile.lock 文件
  4. cd ios && pod install
  5. 运行项目npx react-native run-ios

希望有用!