# Xcode更新后 各种编译失败 解决方法

Xcode11.3更新后有坑,这。。。 已经习惯了。。。
到现在我还是用的Xcode10.3 打包上传,不知道落伍了没,不过问过身边好几个都这样哦,因为升级的坑还是有不少的。赶进度的,就不要升级了。但是我还是手残没忍住,加班fix吧~ 。当然做好了另一手打算,同时下载Xcode 10.3的xip文件,无奈网速虽然很快,但是解压着实很慢~

本来有Xcode10_3、Xcode(11.1)两个版本在Applications文件夹里,但是同意自动更新后,更新完后只剩下一个Xcode了Version 11.3 (11C29)

build原工程 error:

下面的错误 发生在3处

1
2
xcrun: error: unable to locate xcodebuild, please make sure the path to the Xcode folder is set correctly!
xcrun: error: You can set the path to the Xcode folder using /usr/bin/xcode-select -switch

设置Xcode -> File -> Project Settings/Workspace Setting -> Build System -> Legacy Build System 貌似解决了

再build冒出另一个问题

1
2
3
4
5
xcrun: error: unable to locate xcodebuild, please make sure the path to the Xcode folder is set correctly!
xcrun: error: You can set the path to the Xcode folder using /usr/bin/xcode-select -switch
Can't exec "": No such file or directory at /Applications/Xcode.app/Contents/Developer/usr/bin/copypng line 89.
ERROR: Failed to run  -q -iphone -f 0 -rem text /Users/dl/Desktop/gitFiles/drbb/dplp/dplp/Vendors/Ali_FILE_SDK/AlivcShortVideo/AlivcShortVideoResource/ShortVideoResource/tail.png /Users/dl/Library/Developer/Xcode/DerivedData/dplp-bxmhpryjhamrkvaexzndhmvytatu/Build/Products/Debug-iphoneos/dplp.app/tail.png
Command /Applications/Xcode.app/Contents/Developer/usr/bin/copypng failed with exit code 255

在build phases 搜索 .png,将*.png都删掉。

又发现另一个error

1
2
3
4
codesign_allocate: error: unable to locate xcodebuild, please make sure the path to the Xcode folder is set correctly!
codesign_allocate: error: You can set the path to the Xcode folder using /usr/bin/xcode-select -switch
/Users/dl/Library/Developer/Xcode/DerivedData/dplp-bxmhpryjhamrkvaexzndhmvytatu/Build/Products/Debug-iphoneos/dplp.app/Frameworks/AlivcConan.framework: the codesign_allocate helper tool cannot be found or used
Command /bin/sh failed with exit code 1

参考 the codesign_allocate helper tool cannot be found or used

做法
把自己最新Xcode版本中的codesign_allocate(我这里的是"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate"中的"codesign_allocate")复制到 /usr/bin/下 如果提示已经有的话直接选择替换即可,就解决了


终于能跑起来了

~~ _ ~~ 为什么这么对我们呢 xcode dev team