Xcode存档命令失败与Ionic电容器和React -命令PhaseScriptExecution失败与非零退出代码.



几天来,在没有改变项目任何细节的情况下,我在Xcode发布阶段一直收到这个错误。我也与其他开发人员分享了我的代码,在他们的计算机上发布不是问题。

下面是错误日志:

PhaseScriptExecution [CP] Embed Pods Frameworks /Users/[USER_NAME]/Library/Developer/Xcode/DerivedData/App-faqqbffxhfofrrewfezzfuhlylqt/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/Script-9592DBEFFC6D2A0C8D5DEB22.sh (in target 'App' from project 'App')
cd /Users/[USER_NAME]/Desktop/Workspace/[APP_NAME]/ios/App
/bin/sh -c /Users/[USER_NAME]/Library/Developer/Xcode/DerivedData/App-faqqbffxhfofrrewfezzfuhlylqt/Build/Intermediates.noindex/ArchiveIntermediates/App/IntermediateBuildFilesPath/App.build/Release-iphoneos/App.build/Script-9592DBEFFC6D2A0C8D5DEB22.sh
mkdir -p /Users/[USER_NAME]/Library/Developer/Xcode/DerivedData/App-faqqbffxhfofrrewfezzfuhlylqt/Build/Intermediates.noindex/ArchiveIntermediates/App/BuildProductsPath/Release-iphoneos/App.app/Frameworks
Symlinked...
rsync --delete -av --filter P .*.?????? --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Capacitor.framework" "/Users/[USER_NAME]/Library/Developer/Xcode/DerivedData/App-faqqbffxhfofrrewfezzfuhlylqt/Build/Intermediates.noindex/ArchiveIntermediates/App/InstallationBuildProductsLocation/Applications/App.app/Frameworks"
building file list ... rsync: link_stat "/Users/[USER_NAME]/Desktop/Workspace/[APP_NAME]/ios/App/../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Capacitor.framework" failed: No such file or directory (2)
done
sent 29 bytes  received 20 bytes  98.00 bytes/sec
total size is 0  speedup is 0.00
rsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/9e200cfa-7d96-11ed-886f-a23c4f261b56/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9]
Command PhaseScriptExecution failed with a nonzero exit code

尝试重新安装电容器,重建pod,整个ios文件夹和项目。也卸载和重新安装Xcode。我总是卡在同一个点上。

Baryon Lee提供的答案对我很有效。但是,对于那些正在寻找必须应用此更改的位置的人,您应该转到以下路径:

/ios/App/Pods/Target Support Files/Pods-App/Pods-App-frameworks.sh

然后替换为:

source="$(readlink "${source}")"

:

source="$(readlink -f "${source}")"

https://github.com/CocoaPods/CocoaPods/issues/11808#issuecomment-1480802886

解决方法是更新所有生成的…-frameworks.sh文件到在readlink调用中添加-f标志。换句话说,就是替换源="$(指向"${来源}"),与源="$(readlink -f"${来源}"),

这是我第一次为CocoaPods做贡献,所以接受它吧半信半疑!

我用离子电容器。我在MacBook M1 Pro和Xcode 14.3上也遇到了同样的问题。我将Xcode降级为14.2,但它减慢了构建过程。

然后我重新安装了14.3并替换了:

source="$(readlink "${source}")"

:

source="$(readlink -f "${source}")"

它起作用了。请记住,只在执行存档操作之前执行此操作。

得到了同样的问题,XCode 14.3是问题!降级到14.2就可以了。https://developer.apple.com/download/all/?q=14.2

由于更改生成的文件很困难,所以我编写了一个post_install脚本,它可以完成其他人上面提到的相同的工作。目标名称取决于您的项目,例如"App"

在你的Podfile中,(ios/App/Podfile)你可以添加这个

post_install do |installer|
installer.aggregate_targets.each do |target|
if target.name == 'Pods-<Target Name>' # Your target name here
frameworkPath = "Pods/Target Support Files/#{target.name}/#{target.name}-frameworks.sh"
puts "Found #{frameworkPath}"
text = File.read(frameworkPath)
new_contents = text.gsub('readlink "${source}"', 'readlink -f "${source}"') # Detect and replace the line
File.open(frameworkPath, "w") {|file| file.puts new_contents}
puts "Updated #{target.name} framework file for xcode 14.3 cocoapods issue"
end
end
end

现在已修复。更新cocoapods到1.12.1

https://github.com/ionic-team/capacitor/issues/6457

最新更新