Xcode 10 報Error: Multiple commands produce類型的錯誤處理
每次升級Xcode后運行項目都會藏有彩蛋
報錯:
Error: Multiple commands produce
Multiple commands produce '/Users/zgw/Library/Developer/Xcode/DerivedData/NoCarCarriers-awieesrvtoxgprhdtiipzcduxlho/Build/Products/Debug-iphonesimulator/NoCarCarriers.app/README.md':
1) Target 'NoCarCarriers' (project 'NoCarCarriers') has copy command from '/Users/zgw/Desktop/trunk_LRS/NoCarCarriers/NoCarCarriers/Tools/MJRefresh/README.md' to '/Users/zgw/Library/Developer/Xcode/DerivedData/NoCarCarriers-awieesrvtoxgprhdtiipzcduxlho/Build/Products/Debug-iphonesimulator/NoCarCarriers.app/README.md'
Multiple commands produce '/Users/zgw/Library/Developer/Xcode/DerivedData/NoCarCarriers-awieesrvtoxgprhdtiipzcduxlho/Build/Products/Debug-iphonesimulator/NoCarCarriers.app/Info.plist':
1) Target 'NoCarCarriers' (project 'NoCarCarriers') has copy command from '/Users/zgw/Desktop/trunk_LRS/NoCarCarriers/NoCarCarriers/Tools/Masonry/Info.plist' to '/Users/zgw/Library/Developer/Xcode/DerivedData/NoCarCarriers-awieesrvtoxgprhdtiipzcduxlho/Build/Products/Debug-iphonesimulator/NoCarCarriers.app/Info.plist'
Xcode10使用了一個的新創(chuàng)建系統(tǒng),比之前的提供更好的可靠性與創(chuàng)建性能够坐,而且可以獲取項目配置問題(默認設(shè)置新創(chuàng)建系統(tǒng))
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中的關(guān)于舊項目New Build System更改適配中提及到以下兩點
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)進行嚴格的檢查帆卓,避免不必要的重建自阱,這個就是錯誤出現(xiàn)的原因掉丽。
錯誤發(fā)生的普遍形式:
1.info.plist
Multiple commands produce '/Users/zgw/Library/Developer/Xcode/DerivedData/NoCarCarriers-awieesrvtoxgprhdtiipzcduxlho/Build/Products/Debug-iphonesimulator/NoCarCarriers.app/Info.plist':
2.README.md
Multiple commands produce '/Users/zgw/Library/Developer/Xcode/DerivedData/NoCarCarriers-awieesrvtoxgprhdtiipzcduxlho/Build/Products/Debug-iphonesimulator/NoCarCarriers.app/README.md':
3.LICENSE
Multiple commands produce '/Users/zgw/Library/Developer/Xcode/DerivedData/NoCarCarriers-awieesrvtoxgprhdtiipzcduxlho/Build/Products/Debug-iphonesimulator/NoCarCarriers.app/LICENSE':
4.Copy Pods Resources
有兩種解決方法:
一码邻、不使用New Build System
在File > Project/Workspace Settings中的Share Project/Workspace Settings 里build system 將 New Build System(Default) 切換成Legacy build system窥摄。
二绪囱、根據(jù)出錯信息测蹲,在新創(chuàng)建系統(tǒng)模式下,去掉多余的引用鬼吵。
關(guān)于Copy Pods Resources每次pod install之后都會出現(xiàn)問題的解決方案扣甲,更新cocoaPod到最新版本
終端:gem install cocoapods --pre