安裝了xcode10之后,運(yùn)行老項(xiàng)目報錯:
提示有重復(fù)文件:
Showing Recent Messages
:-1: Multiple commands produce '/Users/huishoubao/Library/Developer/Xcode/DerivedData/Customer-dogpkovoxdyzcfezweifcnjtfjgc/Build/Products/Debug-iphonesimulator/TesseractOCRiOS/config_auto.h':
1) Target 'TesseractOCRiOS' (project 'Pods') has copy command from '/Users/huishoubao/Desktop/iOS2B/Customer/Customer/Pods/TesseractOCRiOS/TesseractOCR/include/leptonica/config_auto.h' to '/Users/huishoubao/Library/Developer/Xcode/DerivedData/Customer-dogpkovoxdyzcfezweifcnjtfjgc/Build/Products/Debug-iphonesimulator/TesseractOCRiOS/config_auto.h'
2) Target 'TesseractOCRiOS' (project 'Pods') has copy command from '/Users/huishoubao/Desktop/iOS2B/Customer/Customer/Pods/TesseractOCRiOS/TesseractOCR/include/tesseract/config_auto.h' to '/Users/huishoubao/Library/Developer/Xcode/DerivedData/Customer-dogpkovoxdyzcfezweifcnjtfjgc/Build/Products/Debug-iphonesimulator/TesseractOCRiOS/config_auto.h'
主要是和Xcode10的更新點(diǎn)有關(guān)系。這邊著重提及下與本問題相關(guān)的一個更新點(diǎn)。
Build System
Again, Xcode 10 uses a new build system. The new build system provides improved reliability and build performance, and it catches project configuration problems that the legacy build system does not.
The legacy build system is still available in Xcode 10. To use the legacy build system, select it in the File > Project/Workspace Settings sheet. Projects configured to use the legacy build system will display an orange hammer icon in the Activity View.
簡單而言蟹漓,Xcode10使用了一個的新創(chuàng)建系統(tǒng)碳蛋,比之前的提供更好的可靠性與創(chuàng)建性能,而且可以獲取項(xiàng)目配置問題(默認(rèn)設(shè)置新創(chuàng)建系統(tǒng))
在蘋果文檔中毯炮,提及Xcode10中的關(guān)于舊項(xiàng)目New Build System更改適配中提及到以下兩點(diǎn)
The new build system has stricter checks for cycles between elements in the build in order to prevent unnecessary rebuilds.
It is an error for any individual file in the build to be produced by more than one build command. For example, if two targets each declare the same output file from a shell script phase, factor out the declaration of the output file into a single target.
New Build System會對構(gòu)建中的元素循環(huán)進(jìn)行嚴(yán)格的檢查逼肯,避免不必要的重建,這個也是錯誤出現(xiàn)的原因桃煎。
錯誤發(fā)生的兩種普遍形式:
1篮幢、info.plist 和.png
錯誤信息
Multiple commands produce '/Users/tjsoft/Library/Developer/Xcode/DerivedData/TYKYTwoLearnOneDo-amcfzswumxdotlgjwdslugmywxch/Build/Products/Debug-iphoneos/TYKYTwoLearnOneDo.app/Info.plist':
1) Target 'TYKYTwoLearnOneDo' (project 'TYKYTwoLearnOneDo') has copy command from '/Users/tjsoft/TYKY /黨建/黔紀(jì)/QianJiDangJian_iOS/TYKYTwoLearnOneDo/Info.plist' to '/Users/tjsoft/Library/Developer/Xcode/DerivedData/TYKYTwoLearnOneDo-amcfzswumxdotlgjwdslugmywxch/Build/Products/Debug-iphoneos/TYKYTwoLearnOneDo.app/Info.plist'
2) Target 'TYKYTwoLearnOneDo' (project 'TYKYTwoLearnOneDo') has process command with output '/Users/tjsoft/Library/Developer/Xcode/DerivedData/TYKYTwoLearnOneDo-amcfzswumxdotlgjwdslugmywxch/Build/Products/Debug-iphoneos/TYKYTwoLearnOneDo.app/Info.plist'
2、Copy Pods Resources
錯誤信息
Multiple commands produce '/Users/tjsoft/Library/Developer/Xcode/DerivedData/TYKYTwoLearnOneDo-amcfzswumxdotlgjwdslugmywxch/Build/Products/Debug-iphoneos/TYKYTwoLearnOneDo.app':
1) Target 'TYKYTwoLearnOneDo' has create directory command with output '/Users/tjsoft/Library/Developer/Xcode/DerivedData/TYKYTwoLearnOneDo-amcfzswumxdotlgjwdslugmywxch/Build/Products/Debug-iphoneos/TYKYTwoLearnOneDo.app'
2) That command depends on command in Target 'TYKYTwoLearnOneDo': script phase “[CP] Copy Pods Resources”
解決方法可以有兩種为迈,
方案一:是不使用New Build System三椿,修改了xcode的配置暫時解決了編譯報錯的問題。
在File > Project/Workspace Settings中的Share Project/Workspace Settings 里build system 將New Build System(Default)切換成Legacy build system葫辐。
方案二:是根據(jù)出錯信息搜锰,在新創(chuàng)建系統(tǒng)模式下,去除多余的引用重建耿战。
Info.plist
在 target -> Build phase > Copy Bundle Resource 中找到info.plist蛋叼,移除
Copy Pods Resources
在 target -> Build phase > Copy Pods Resources -> Output Files,移除${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}
第三方SDK內(nèi)重復(fù)的文件
是在pod進(jìn)去的文件中,重命名的文件狈涮,打開查看了狐胎,發(fā)現(xiàn)內(nèi)容不一樣。
因?yàn)槭堑谌絪dk里面的歌馍,我不確定刪除哪個握巢,就更改了build system ,將New Build System(Default)切換成Legacy build system骆姐。