升级Xcode 14.3编译打包报错

date
Apr 3, 2023
slug
xcode1403
status
Published
tags
iOS
summary
type
Post
周末在家把Xcode升级到了最新14.3,今天来公司打包项目居然失败了,真是手贱喃。。。
 

报错一

ld: file not found: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_iphonesimulator.a
notion image
这是因为Xcode 14.3之后只支持iOS 11及以上打包,所以要将项目中的Target最低改为11。
如果是Pod工程,其Pod子工程也需要更新。
在Podfile里添加(或修改为)下面内容,然后重新执行pod install
post_install do |installer|
  installer.generated_projects.each do |project|
    project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
         end
    end
  end
end
注意,如果是通过下面这种这种方式修改,重新执行pod install后被恢复
notion image
 

报错二

PhaseScriptExecution [CP]\ Embed\ Pods\ Frameworks

mkdir -p /Users/max/Library/Developer/Xcode/DerivedData/Max-dmwafkgdrzqavzcmbdjbjgmmuxby/Build/Intermediates.noindex/ArchiveIntermediates/Release_preprod/BuildProductsPath/Release_preprod-iphoneos/MaxApp.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/ActionSheetPicker_3_0.framework" "/Users/max/Library/Developer/Xcode/DerivedData/Max-dmwafkgdrzqavzcmbdjbjgmmuxby/Build/Intermediates.noindex/ArchiveIntermediates/Release_preprod/InstallationBuildProductsLocation/Applications/MaxApp.app/Frameworks"

building file list ... rsync: link_stat "/Users/max/Workspace/MaxApp/../../../IntermediateBuildFilesPath/UninstalledProducts/iphoneos/ActionSheetPicker_3_0.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
在Xcode项目找到文件Pods-APPNAME-frameworks.sh,其中APPNAME 要换成你的工程名称,将里面
if [ -L "${source}" ]; then
    echo "Symlinked..."
    source="$(readlink "${source}")"
  fi
替换为
if [ -L "${source}" ]; then
    echo "Symlinked..."
    source="$(readlink -f "${source}")"
  fi
即,增加-f
 
参考资料:
 

© 刘德华 2020 - 2023