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

React Native 0.73 iOS构建Sandbox权限报错,求非临时根治方案

解决React Native 0.73.6 iOS构建沙箱权限(rsync.samba)拒绝问题

问题症状

执行react-native run-ios或通过Xcode构建React Native 0.73.6项目时,触发沙箱权限拒绝错误,核心报错如下:

Sandbox: rsync.samba(7041) deny(1) file-read-data /Users/-ajen010/Library/Developer/Xcode/DerivedData/itstime-fusdcdrjasehwueoyulohqzxdotg/Build/Products/Debug-iphonesimulator/XCFrameworkIntermediates/Flipper-DoubleConversion/double-conversion.framework/_CodeSignature (in target 'itstime' from project 'itstime')
error: Sandbox: rsync.samba(7042) deny(1) file-write-create /Users/ajen010/Library/Developer/Xcode/DerivedData/itstime-fusdcdrjasehwueoyulohqzxdotg/Build/Products/Debug-iphonesimulator/itstime.app/Frameworks/double-conversion.framework/_CodeSignature (in target 'itstime' from project 'itstime')
error: Sandbox: rsync.samba(7041) deny(1) file-read-data /Users/ajen010/Library/Developer/Xcode/DerivedData/itstime-fusdcdrjasehwueoyulohqzxdotg/Build/Products/Debug-iphonesimulator/XCFrameworkIntermediates/Flipper-DoubleConversion/double-conversion.framework/Info.plist (in target 'itstime' from project 'itstime')
error: Sandbox: rsync.samba(7043) deny(1) file-write-create /Users/ajen010/Library/Developer/Xcode/DerivedData/itstime-fusdcdrjasehwueoyulohqzxdotg/Build/Products/Debug-iphonesimulator/itstime.app/Frameworks/double-conversion.framework/.double-conversion.4nf1M8

已知临时方案为关闭Xcode的User Scripting Sandbox,但需根治方法。

系统环境

OS: macOS 14.4.1
CPU: (10) arm64 Apple M2 Pro
Memory: 113.09 MB / 16.00 GB
Shell:
  version: 3.2.57
  path: /bin/bash
Binaries:
  Node:
    version: 18.20.1
    path: ~/.nvm/versions/node/v18.20.1/bin/node
  Yarn: Not Found
  npm:
    version: 10.5.0
    path: ~/.nvm/versions/node/v18.20.1/bin/npm
  Watchman:
    version: 2024.04.01.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
IDEs:
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
npmPackages:
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.6
    wanted: 0.73.6
iOS:
  hermesEnabled: true
  newArchEnabled: false

已尝试修改DerivedData权限、删除该目录、赋予终端和Xcode全盘访问权限,问题未解决。

根治解决方案

方案1:升级Flipper依赖版本

该问题源于旧版Flipper的XCFramework打包逻辑与Xcode15沙箱机制不兼容,升级至兼容版本即可解决:

  • 打开项目根目录的Podfile
  • 找到Flipper配置块,修改为兼容Xcode15的版本:
    use_flipper!({ 'Flipper' => '0.208.0', 'Flipper-Folly' => '2.6.10', 'Flipper-DoubleConversion' => '3.2.0' })
    
  • 执行终端命令更新Pods:
    pod install --repo-update
    
  • 清理Xcode DerivedData,重启Xcode后重新构建

方案2:禁用Flipper(无需调试工具时适用)

如果不需要Flipper的调试功能,直接禁用可彻底规避该问题:

  • 打开Podfile,注释掉所有Flipper相关配置:
    # use_flipper!()
    # post_install do |installer|
    #   flipper_post_install(installer)
    # end
    
  • 执行终端命令更新Pods:
    pod install
    
  • 清理Xcode缓存,重新构建项目

方案3:修复rsync路径权限

若系统中存在多个rsync版本(如Homebrew安装的rsync),Xcode调用非系统自带版本会触发沙箱拒绝:

  • 在终端执行命令确认rsync路径:
    which rsync
    
  • 若输出不是/usr/bin/rsync,需在Xcode中指定系统自带路径:
    1. 打开Xcode项目,进入目标Target的Build Phases
    2. 找到[CP] Copy Pods Resources或[CP] Embed Pods Frameworks脚本
    3. 将脚本中所有rsync替换为/usr/bin/rsync
  • 保存修改后重新构建

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.26 07:17:11