轉(zhuǎn)自:http://m.itdecent.cn/p/fdb1421f3c8b
更新Xcode 10,自然開始第一時(shí)間運(yùn)行老項(xiàng)目,踩坑填坑
這邊記錄下基本出現(xiàn)的問題
Error: Multiple commands produce
Xcode10的更新點(diǎn)這里筆者不在闡述,想了解的自行Google。這邊著重提及下與本問題相關(guān)的一個(gè)更新點(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.
簡(jiǎn)單而言,Xcode10使用了一個(gè)的新創(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會(huì)對(duì)構(gòu)建中的元素循環(huán)進(jìn)行嚴(yán)格的檢查,避免不必要的重建,這個(gè)也是錯(cuò)誤出現(xiàn)的原因。
錯(cuò)誤發(fā)生的兩種普遍形式:
1、info.plist
錯(cuò)誤信息
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 copycommandfrom'/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 processcommandwith output'/Users/tjsoft/Library/Developer/Xcode/DerivedData/TYKYTwoLearnOneDo-amcfzswumxdotlgjwdslugmywxch/Build/Products/Debug-iphoneos/TYKYTwoLearnOneDo.app/Info.plist'
2、Copy Pods Resources
錯(cuò)誤信息
Multiple commands produce'/Users/tjsoft/Library/Developer/Xcode/DerivedData/TYKYTwoLearnOneDo-amcfzswumxdotlgjwdslugmywxch/Build/Products/Debug-iphoneos/TYKYTwoLearnOneDo.app':1) Target'TYKYTwoLearnOneDo'has create directorycommandwith output'/Users/tjsoft/Library/Developer/Xcode/DerivedData/TYKYTwoLearnOneDo-amcfzswumxdotlgjwdslugmywxch/Build/Products/Debug-iphoneos/TYKYTwoLearnOneDo.app'2) Thatcommanddepends oncommandinTarget'TYKYTwoLearnOneDo': script phase “[CP] Copy Pods Resources”
解決方法可以有兩種,一種是不使用New Build System,在File > Project/Workspace Settings中的Share Project/Workspace Settings 里build system 將New Build System(Default)切換成Legacy build system。

其次是根據(jù)出錯(cuò)信息,在新創(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}

2018.11.03
關(guān)于Copy Pods Resources每次pod install之后都會(huì)出現(xiàn)問題的解決方案,更新cocoaPod到最新版本1.6.0.beta.2
gem install cocoapods --pre
需要換源的使用
gem sources --add https://gems.ruby-china.com --remove https://gems.ruby-china.org
參考文獻(xiàn):