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

React Native构建iOS时react-native-image-picker编译报错求助

解决react-native-image-picker iOS编译失败问题

以下是针对该编译错误的几种有效解决方法:

  • 清理并重新安装依赖

    1. 进入ios目录,清理Pod相关文件:
      cd ios
      rm -rf Pods Podfile.lock
      pod deintegrate
      
    2. 重新安装Pods:
      pod install
      
    3. 返回项目根目录,清理npm/yarn依赖并重新安装:
      cd ..
      rm -rf node_modules package-lock.json yarn.lock
      npm install # 用yarn的话执行 yarn install
      
  • 清理Xcode构建缓存

    1. 打开Xcode,按Shift+Command+K清理构建文件夹
    2. 删除Xcode的DerivedData缓存目录:
      rm -rf ~/Library/Developer/Xcode/DerivedData
      
  • 检查版本兼容性
    确认react-native-image-picker版本与你的React Native版本匹配,若RN版本较新,升级到最新稳定版:

    npm install react-native-image-picker@latest
    

    升级完成后再次进入ios目录执行pod install

  • 检查Xcode项目配置
    打开ios项目的.xcworkspace文件,找到react-native-image-picker的target:

    • 在Build Settings中确保C++ Standard Library设置为libc++
    • 确认Architectures为Standard Architectures (arm64, x86_64)
  • 重新构建项目
    执行原命令重新运行:

    npx react-native run-ios -- --reset-cache
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.27 17:39:57