IOS下XCODE10错误:Multiple commands produce解决方法
使用XCode10编译老项目时报错;
Xcode10使用了一个的新创建系统,比之前的提供更好的可靠性与创建性能,而且可以获取项目配置问题(默认设置新创建系统);在苹果文档中,提及Xcode10中的关于旧项目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会对构建中的元素循环进行严格的检查,避免不必要的重建,这个也是错误出现的原因。
错误发生的两种普遍形式:
1、info.plist
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 /党建/黔纪/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,在File > Project/Workspace Settings中的Share Project/Workspace Settings 里build system 将New Build System(Default)切换成Legacy build system。
其次是根据出错信息,在新创建系统模式下,去除多余的引用重建。
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
关于Copy Pods Resources每次pod install之后都会出现问题的解决方案,更新cocoaPod到最新版本 1.6.0.beta.2
gem install cocoapods --pre
需要换源的使用
gem sources --add https://gems.ruby-china.com --remove https://gems.ruby-china.org
参考文献:
What’s new in Xcode 10?
Build System Release Notes for Xcode 10
Showing Recent Messages
:-1: Multiple commands produce '/Users/tt/Library/Developer/Xcode/DerivedData/llh_cocos04-adteufwotlxetqfvbbzjfizcfemv/Build/Products/Debug-iphonesimulator/llh_cocos04-mobile.app/Icon-87.png':
1) Target 'llh_cocos04-mobile' (project 'llh_cocos04') has copy command from '/Users/tt/Documents/project/llh-cocos/proj.ios_mac/Icon-87.png' to '/Users/tt/Library/Developer/Xcode/DerivedData/llh_cocos04-adteufwotlxetqfvbbzjfizcfemv/Build/Products/Debug-iphonesimulator/llh_cocos04-mobile.app/Icon-87.png'
2) Target 'llh_cocos04-mobile' (project 'llh_cocos04') has copy command from '/Users/tt/Documents/project/llh-cocos/proj.ios_mac/ios/Icon-87.png' to '/Users/tt/Library/Developer/Xcode/DerivedData/llh_cocos04-adteufwotlxetqfvbbzjfizcfemv/Build/Products/Debug-iphonesimulator/llh_cocos04-mobile.app/Icon-87.png'
Showing Recent Messages
:-1: Multiple commands produce '/Users/tt/Library/Developer/Xcode/DerivedData/llh_cocos04-adteufwotlxetqfvbbzjfizcfemv/Build/Products/Debug-iphonesimulator/llh_cocos04-mobile.app/Icon-180.png':
1) Target 'llh_cocos04-mobile' (project 'llh_cocos04') has copy command from '/Users/tt/Documents/project/llh-cocos/proj.ios_mac/Icon-180.png' to '/Users/tt/Library/Developer/Xcode/DerivedData/llh_cocos04-adteufwotlxetqfvbbzjfizcfemv/Build/Products/Debug-iphonesimulator/llh_cocos04-mobile.app/Icon-180.png'
2) Target 'llh_cocos04-mobile' (project 'llh_cocos04') has copy command from '/Users/tt/Documents/project/llh-cocos/proj.ios_mac/ios/Icon-180.png' to '/Users/tt/Library/Developer/Xcode/DerivedData/llh_cocos04-adteufwotlxetqfvbbzjfizcfemv/Build/Products/Debug-iphonesimulator/llh_cocos04-mobile.app/Icon-180.png'
按照下图的顺序,找到对应的位置,删除重复的文件即可。
上一篇: flutter入门-环境搭建