Xcode 10 中关于 Error: Multiple commands produce

安装了xcode10之后,运行老项目报错:
提示有重复文件:

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的更新点有关系。这边着重提及下与本问题相关的一个更新点。

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使用了一个的新创建系统,比之前的提供更好的可靠性与创建性能,而且可以获取项目配置问题(默认设置新创建系统)

在苹果文档中,提及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 和.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 /党建/黔纪/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。


Xcode 10 中关于 Error: Multiple commands produce_第1张图片
设置build system.png

方案二:是根据出错信息,在新创建系统模式下,去除多余的引用重建。

Info.plist

在 target -> Build phase > Copy Bundle Resource 中找到info.plist,移除

Xcode 10 中关于 Error: Multiple commands produce_第2张图片
删除相应的重复文件.png

Copy Pods Resources

在 target -> Build phase > Copy Pods Resources -> Output Files,移除${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}

Xcode 10 中关于 Error: Multiple commands produce_第3张图片
删除copy Pod文件.png

第三方SDK内重复的文件

是在pod进去的文件中,重命名的文件,打开查看了,发现内容不一样。


Xcode 10 中关于 Error: Multiple commands produce_第4张图片
重复文件.png

因为是第三方sdk里面的,我不确定删除哪个,就更改了build system ,将New Build System(Default)切换成Legacy build system。

参考链接:https://www.jianshu.com/p/fdb1421f3c8b

你可能感兴趣的:(Xcode 10 中关于 Error: Multiple commands produce)