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

React Native 0.73升级iOS构建报错:_OBJC_CLASS_$_RCTEventDispatcher未定义

React Native 0.73 iOS构建链接错误:OBJC_CLASS$_RCTEventDispatcher未定义解决方案

针对RN 0.73升级后App Center iOS流水线出现的_OBJC_CLASS_$_RCTEventDispatcher未定义链接错误(涉及RNReanimated和react-native-video),以下是几个针对性的排查和解决步骤:

  • 确认Podfile依赖配置
    确保所有相关target(主App target、ImageNotification等扩展target)都正确引入React Core模块。如果autolinking失效,可在Podfile中显式添加:

    target 'YourAppTarget' do
      pod 'React/Core', :path => '../node_modules/react-native/'
      # 其他依赖声明...
    end
    
    target 'ImageNotification' do
      pod 'React/Core', :path => '../node_modules/react-native/'
      pod 'RNReanimated', :path => '../node_modules/react-native-reanimated'
    end
    

    执行pod install --repo-update重新安装依赖。

  • 彻底清理构建缓存
    在App Center流水线中加入完整的清理步骤,避免缓存导致的依赖不一致:

    # 清理Pod依赖
    cd ios && pod deintegrate
    rm -rf Pods/ Podfile.lock
    pod install --repo-update
    
    # 清理Xcode构建缓存
    xcodebuild clean -workspace YourApp.xcworkspace -scheme YourAppScheme
    
  • 验证依赖版本兼容性
    确保react-native-reanimated和react-native-video使用RN 0.73兼容版本:

    • react-native-reanimated需≥3.5.0
    • react-native-video需≥6.2.0
      重新安装依赖确保无残留:
    npm uninstall react-native-reanimated react-native-video
    npm install react-native-reanimated react-native-video
    cd ios && pod install
    
  • 检查Xcode Target构建配置
    对报错的target(主App、ImageNotification)检查以下Build Settings:

    1. Other Linker Flags:确保包含-ObjC和-lc++,且保留$(inherited)
    2. Framework Search Paths:添加$(inherited)和../node_modules/react-native/React路径
  • 确认App Center构建环境

    1. 将Xcode版本升级至14.3及以上(RN 0.73官方推荐版本,最低14版本存在兼容性缺陷)
    2. 确保构建环境中Node版本锁定为18.x,避免版本波动
  • 手动关联依赖库
    打开Xcode工程,找到RNReanimated和react-native-video的target:

    1. 进入Build Phases → Link Binary With Libraries
    2. 添加libReact-Core.a(静态库模式)或React-Core.framework(动态库模式)

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.21 22:48:18