是否有另一种解决方案来解决“Sandbox: rsync.samba(76010) deny(1) file-write-create error”而不是将 ENABLE_USER_SCRIPT_SANDBOXING 设置为 NO?

问题描述 投票:0回答:1

安装 Mapbox 后在 Xcode 中构建项目时遇到这些错误:

error: Sandbox: rsync.samba(76010) deny(1) file-write-create /Users/lluis/Library/Developer/Xcode/DerivedData/MyProject-dlpddtwcucwpygcxhthjwisifahq/Build/Products/Debug-iphonesimulator/MyProject-Des.app/Frameworks/MapboxMaps.framework/MapboxMapsResources.bundle (in target 'MyProject-Des' from project 'MyProject')
error: Sandbox: rsync.samba(76011) deny(1) file-write-create /Users/lluis/Library/Developer/Xcode/DerivedData/MyProject-dlpddtwcucwpygcxhthjwisifahq/Build/Products/Debug-iphonesimulator/MyProject-Des.app/Frameworks/MapboxMaps.framework/.Info.plist.7j5Zxx (in target 'MyProject-Des' from project 'MyProject')
error: Sandbox: rsync.samba(76011) deny(1) file-write-create /Users/lluis/Library/Developer/Xcode/DerivedData/MyProject-dlpddtwcucwpygcxhthjwisifahq/Build/Products/Debug-iphonesimulator/MyProject-Des.app/Frameworks/MapboxMaps.framework/.MapboxMaps.rIRQea

我尝试过 ChatGPT 并检查了很多不同的地方,例如以下链接: https://stackoverflow.com/questions/76590131/error-while-build-ios-app-in-xcode-sandbox-rsync-samba-13105-deny1-file-w https://forums.developer.apple.com/forums/thread/759995 https://www.youtube.com/watch?v=MoR-vopM1HY https://forums.developer.apple.com/forums/thread/708282 https://stackoverflow.com/questions/77660771/understanding-build-error-xcode-sandbox-bash30970-deny1-file-read-data

所有这些最终都得到相同的解决方案:将

ENABLE_USER_SCRIPT_SANDBOXING
设置为
NO
。在我看来,网上没有其他真正的解决方案。 我已按照所有说明进行操作,将
ENABLE_USER_SCRIPT_SANDBOXING
设置为
NO
,并每次都清理我的项目:

rm -rf ~/Library/Caches/CocoaPods
rm -rf ios/Pods
rm -rf ios/Podfile.lock
rm -rf ~/Library/Developer/Xcode/DerivedData/*
cd ios
pod deintegrate
pod setup
pod install --repo-update

虽然它实际上对我有用,但我想知道在将

ENABLE_USER_SCRIPT_SANDBOXING
留给
YES
时是否还有其他解决办法。

我知道当 Xcode 尝试在 forbidden 位置写入文件时,在构建过程中会发生此错误,但我真的不明白为什么会发生此错误。

我正在使用 ruby、Cocoapods、npm、Xcode、React-native、react-native-config、@rnmapbox/maps、firebase 等的最新版本。

这些版本组合起来是否存在某种问题? 我应该降级其中一些组件版本吗? 我应该“篡改”我的构建阶段吗?

我正在使用 ruby“3.3.0”,Xcode 15.4。该系统正在使用 Cocoapods 1.15.2,尽管我的 Gemfile 看起来像这样:

source 'https://rubygems.org'

# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby "3.3.0"

# Cocoapods 1.15 introduced a bug which break the build. We will remove the upper
# bound in the template on Cocoapods with next React Native release.
gem 'cocoapods', '>= 1.13', '< 1.15'
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'

也许这条评论(# Cocoapods 1.15引入了一个破坏构建的错误。我们将在下一个React Native版本中删除Cocoapods上模板的上限。)是关键?

这是 MyPodfile:

# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, min_ios_version_supported
prepare_react_native_project!

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

target 'MyProject' do
  config = use_native_modules!

use_frameworks! :linkage => :static # Added following instructions for Firebase https://rnfirebase.io/#altering-cocoapods-to-use-frameworks
$RNFirebaseAsStaticFramework = true # Added following instructions for Firebase https://rnfirebase.io/#altering-cocoapods-to-use-frameworks

  use_react_native!(
    :path => config[:reactNativePath],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )
  target 'MyProject-Des' do
    inherit! :complete
  end
  target 'MyProject-Pre' do
    inherit! :complete
  end

  # MAPBOX START
  pre_install do |installer|
  $RNMapboxMaps.pre_install(installer)
  end
  # MAPBOX END

  post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false,
      # :ccache_enabled => true
    )
    # MAPBOX START
    $RNMapboxMaps.post_install(installer)
    # MAPBOX END
  end
end

提前非常感谢!

ios react-native mapbox sandbox
1个回答
0
投票

我刚刚创建的新项目面临同样的问题。你找到解决办法了吗?

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.