You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

XCode 14.3中RCTBridgeModule.h缺失,React Native iOS构建失败

问题描述

升级笔记本配置后,现有React Native iOS应用无法构建。对比新旧电脑发现新设备缺少Pods_hp_mobile框架文件夹,不清楚该文件夹的生成方式。已尝试重新安装Pods,安装过程显示正常,但问题仍未解决。

系统配置

System:
    OS: macOS 13.4.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 3.85 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.4.0 - ~/.nvm/versions/node/v20.4.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v20.4.0/bin/yarn
    npm: 9.7.2 - ~/.nvm/versions/node/v20.4.0/bin/npm
    Watchman: 2023.07.10.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /Users/username/.rvm/gems/ruby-2.7.4/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
    Android SDK:
      API Levels: 28, 29, 30, 31, 32, 33, 34
      Build Tools: 30.0.2, 30.0.3, 33.0.0, 33.0.1, 33.0.2, 34.0.0
      System Images: android-34 | Google APIs ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2022.2 AI-222.4459.24.2221.10121639
    Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild
  Languages:
    Java: 17.0.7 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2
    react-native: 0.67.5 => 0.67.5
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Pod安装日志

npx pod-install
Scanning for pods...
1.11.2
> pod install
Adding a custom script phase for Pod RNFBApp: [RNFB] Core Configuration
Auto-linking React Native modules for target `hp_mobile`: RNAWSCognito, RNBluetoothStateManager, RNCAsyncStorage, RNCPicker, RNDateTimePicker, RNDeviceInfo, RNFBApp, RNFBMessaging, RNGestureHandler, RNNotifee, RNReanimated, RNSVG, RNScreens, RNSensors, react-native-biometrics, react-native-geolocation-service, react-native-get-random-values, react-native-netinfo, react-native-notifications, react-native-safe-area-context, and react-native-version-info
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There are 54 dependencies from the Podfile and 63 total pods installed.
排查方向与解决方案
  • 彻底清理Pod缓存与残留文件

    1. 进入iOS项目目录,执行:rm -rf Pods Podfile.lock
    2. 删除Xcode构建缓存:rm -rf ~/Library/Developer/Xcode/DerivedData
    3. 清理CocoaPods全局缓存:pod cache clean --all
    4. 重新执行npx pod-install或pod install
  • 检查Xcode项目配置

    1. 打开Xcode项目,查看Build Phases→Link Binary With Libraries,确认是否存在Pods_hp_mobile.framework的引用
    2. 检查Build Settings→Framework Search Paths,确保包含$(inherited)和$(PROJECT_DIR)/Pods/Products路径
    3. 确认项目Target名称为hp_mobile——Pod生成的框架文件夹名称与Target名称强绑定
  • 适配M1芯片环境

    1. 终端执行arch -x86_64 pod install,强制以x86架构运行CocoaPods(部分旧版本依赖不兼容arm64)
    2. 开启Xcode Rosetta模式:右键Xcode图标→显示简介→勾选“使用Rosetta打开”,重启Xcode后重新构建
  • 修复版本兼容性问题
    当前React Native 0.67.5与Xcode 14.3.1存在适配问题,可尝试:

    1. 更新CocoaPods到1.12.x版本:gem install cocoapods -v 1.12.1
    2. 在Podfile末尾添加适配配置:
      post_install do |installer|
        installer.pods_project.targets.each do |target|
          target.build_configurations.each do |config|
            config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
            config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
          end
        end
      end
      

    添加后重新执行pod install

  • 验证Pod项目完整性

    1. 打开项目目录下的Pods/Pods.xcodeproj,检查是否存在hp_mobile目标,以及对应的框架产物是否生成
    2. 若Pod项目无该目标,检查Podfile是否正确包裹target 'hp_mobile' do ... end代码块,确保所有依赖都在该块内

内容的提问来源于stack exchange,提问作者mjmostachetti

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.15 23:03:08