51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

Xcode14自动化打包iOS 和手动打包(Archive)出错的解决方案

手动打包时错误信息

PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/user/Library/Developer/Xcode/DerivedData/xxx-dtvcxmqutmyletflrluqqigdiacq/Build/Intermediates.noindex/ArchiveIntermediates/xxx/IntermediateBuildFilesPath/xxx/Release-iphoneos/MINISOEATest.build/Script-10F7DA1728D7FFB6005E102E.sh (in target 'xxx' from project 'xxx'

rsync error: some files could not be transferred (code 23) at /AppleInternal/Library/BuildRoots/97f6331a-ba75-11ed-a4bc-863efbbaf80d/Library/Caches/com.apple.xbs/Sources/rsync/rsync/main.c(996) [sender=2.6.9]

Command PhaseScriptExecution failed with a nonzero exit code

使用Jenkins自动化打包报错

16:35:02 ** ARCHIVE FAILED **
16:35:02 
16:35:02 
16:35:02 The following build commands failed:
16:35:02    PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks /Users/liuyihua/Library/Developer/Xcode/DerivedData/FetaphonHome-glveenzzrwmsdgdcvvvzqvsyuyaj/Build/Intermediates.noindex/ArchiveIntermediates/FetaphonHome_test/IntermediateBuildFilesPath/FetaphonHome.build/Test-iphoneos/FetaphonHome.build/Script-C2228B8BCF2259F364643CE3.sh (in target 'FetaphonHome' from project 'FetaphonHome')
16:35:02 (1 failure)
16:35:02 Build step 'Execute shell' marked build as failure
16:35:02 Finished: FAILURE

暂时解决方式一 :

xxx/Pods/Target Support Files/Pods-xxx/ Pods-xxx-frameworks.sh

找到Pod文件下面的Pods-xxx-frameworks.sh 下面的   source="$(readlink "${source}")"  
改成   source="$(readlink -f"${source}")"

使用Jenkins自动化打包 的解决方式二 :

使用脚本解决:每次pod install 之后直接调用此脚本运行,自动更新

#!/bin/bash

#项目名称
objectName="objectName"
#获取
cd "${PWD}/Pods/Target Support Files/Pods-${objectName}/"

#修改
sed -i '' '44s/source="$(readlink "${source}")"/source="$(readlink -f "${source}")"/' Pods-${objectName}-frameworks.sh

#对修改后的文件进行验证
sed -n '44p' Pods-${objectName}-frameworks.sh

#将44行内容赋值给一个变量,判断是否含有 "-f" 字符串,有就打印"修改成功",没有就打印"修改失败"
if [[ $(sed -n '44p' Pods-${objectName}-frameworks.sh) =~ "-f" ]]; then
    echo "修改成功"
else
    echo "修改失败"
fi
赞(0)
未经允许不得转载:工具盒子 » Xcode14自动化打包iOS 和手动打包(Archive)出错的解决方案