本文翻译自:Xcode 10 Error: Multiple commands produce
error: Multiple commands produce '/Users/uesr/Library/Developer/Xcode/DerivedData/OptimalLive-fxatvygbofczeyhjsawtebkimvwx/Build/Products/Debug-iphoneos/OptimalLive.app/Info.plist':
1) Target 'OptimalLive' has copy command from '/Users/uesr/Desktop/workSpace/SEALIVE/SeaLive1.1/OptimalLive/Info.plist' to '/Users/uesr/Library/Developer/Xcode/DerivedData/OptimalLive-fxatvygbofczeyhjsawtebkimvwx/Build/Products/Debug-iphoneos/OptimalLive.app/Info.plist'
2) Target 'OptimalLive' has copy command from '/Users/uesr/Desktop/workSpace/SEALIVE/SeaLive1.1/OptimalLive/Server/Masonry/Info.plist' to '/Users/uesr/Library/Developer/Xcode/DerivedData/OptimalLive-fxatvygbofczeyhjsawtebkimvwx/Build/Products/Debug-iphoneos/OptimalLive.app/Info.plist'
3) Target 'OptimalLive' has process command with input '/Users/uesr/Desktop/workSpace/SEALIVE/SeaLive1.1/OptimalLive/Info.plist'
running the code in Xcode9 works, but results in an error in Xcode10. 在Xcode9中运行代码可以运行,但是会在Xcode10中导致错误。
#1楼
参考:https://stackoom.com/question/3Qo4Y/Xcode-错误-产生多个命令
#2楼
While checking the build log, I noticed a warning: 在检查构建日志时,我注意到一个警告:
note: Using new build system
note: Planning build
note: Constructing build description
Build system information
warning: The Copy Bundle Resources build phase contains this target's Info.plist file '/Users/<redacted>/Repositories/Whitesmith/optimize-ios/Carthage/Checkouts/WSStatusBarNotification/Miscellaneous/Info.plist'. (in target 'JDStatusBarNotification')
So, if that's your case then just go to your target: 因此,如果是您的情况,那么请转到目标:
- Build Phases 建造阶段
- Copy Bundle Resource 复制捆绑资源
- Remove
info.plist
. 删除info.plist
。
#3楼
The issue might be occurring because of multiple Plist or other files within App- 该问题可能是由于App-中的多个Plist或其他文件而引起的
Solution -> Open target -> Build phases > Copy Bundle Resources and remove info.plist
from there. 解决方案->打开目标->构建阶段>复制捆绑资源,然后从中删除info.plist
。
Note: If you have developed a watch app too then you will have to remove the plist from the watch and watch-extension too. 注意:如果您还开发了手表应用程序,则还必须从手表中删除plist并扩展手表。
#4楼
Try this as well. 也尝试一下。 Xcode->File->Project Settings-> Build System -> Legacy Build System. Xcode-> File-> Project Settings-> Build System-> Legacy Build System。
#5楼
I had this problem when I had a file with the same name in two different targets. 当我在两个不同的目标中有一个具有相同名称的文件时,我遇到了这个问题。 For some reason one of those files I had part of both targets. 由于某种原因,我有两个目标之一。 So basically I had two files. 所以基本上我有两个文件。 And both of those files belonged to one target. 这些文件都属于一个目标。
It makes sense that a target can only have one file name per target, so just unchecking the target member box for the file that wasn't related to the main target fixed the issue. 一个目标每个目标只能有一个文件名是有道理的,因此只需取消选中与主要目标无关的文件的目标成员框即可解决此问题。
#6楼
I had bunch of Multiple commands produce
warnings - not limited to info.plist duplication in one target. 我有一堆的Multiple commands produce
警告-不限于一个目标中的info.plist复制。 Including localized resources and string files, headers etc. 包括本地化资源和字符串文件,标头等
Solution: remove all duplications in target membership. 解决方案:删除目标成员资格中的所有重复项。