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'

在Xcode 9中运行代码正常,但在Xcode 10中有一个错误。


当前回答

检查您支持的平台!

我们花了几个月的时间来研究这个问题。我们发现AVAILABLE_PLATFORMS被设置为“appletvos appletvsimulator iphoneos iphoneonesemulator macosx watchos watchsimulator”,这将导致构建多个平台,这将导致“多个命令产生错误”。例如,“Foo”平台正在为iOS和TVOS构建,因此多个构建命令正在创建一个Foo.framework文件。

我们一出发就去

AVAILABLE_PLATFORMS = iphoneos iphonesimulator

在我们的根xcconfig文件中,这个问题在所有子项目中都消失了。

检查您的配置

Run

xcodebuild -project FitbitMobile.xcodeproj -target "FitbitMobile" -showBuildSettings > BuildSettings.txt

查看输出是否被设置为您所期望的值。如果你是一款iOS应用,并且你正在为tvOS开发,你将需要更新你的配置。

其他回答

这个答案已经弃用了——Xcode 12已经弃用了遗留构建系统,它将在进一步的版本中被移除

我使用的是Xcode 11.4 不能构建旧项目

Xcode => File => Project Settings => Build System => Legacy Build System

我在用Core Data做实验。我为一个简单的检查表程序构建了一个数据模型,并生成了NSManagedObjects。当我编译项目时,我得到了以下错误:

error: Multiple commands produce '/Users/myUSerName/Library/Developer/Xcode/DerivedData/myCoreDateExperiment-gzbslaqdwglkzxemijpdqmizgyzc/Build/Intermediates.noindex/ myCoreDateExperiment /Debug-iphonesimulator/ myCoreDateExperiment.build/Objects-normal/x86_64/CheckListItem+CoreDataProperties.o':
1) Target ' myCoreDateExperiment ' (project ' myCoreDateExperiment ') has compile command for Swift source files
2) Target ' myCoreDateExperiment ' (project ' myCoreDateExperiment ') has compile command for Swift source files

问题在于数据模型(核对表)。xcdatamodeld(在我的例子中)在“编译源”列表中。当我从列表中删除该项目时,该项目编译干净。

打开项目导航器并选择项目(顶部的第一个条目) 在“项目和目标”窗格中的目标下选择您的构建目标 选择顶部附近的Build Phases选项 展开“Compile Sources”条目并查找数据模型名称。如果找不到,可以搜索“xcdatamodeld”。 从编译列表中删除模型 确保数据模型包含在“Copy Bundle Resources”列表中。如果缺少,请添加。

EDIT

@WilliamT。在评论中解释,您需要在编译列表中使用xcdatamodeld。相反,转到xcdatamodeld文件中的实体。选择出错的模型,展开左侧面板,并将“Codegen”字段更改为“Manual/None”。

如果你是通过Ditto命令创建同名的多个实例(而不是“复制文件”构建阶段)得到这个,你可能必须改变产品模块名称。

点击Xcode抱怨的目标 点击构建设置 搜索“产品模块名称” 将名称更改为唯一的名称

在我们的应用中,我们有一个观察目标和一些通知目标,所以我把Extension之类的东西放在模块名的末尾。

我最初在这里找到了这个解决方案:https://forums.developer.apple.com/thread/103913

在开始之前,请注意我的项目使用Carthage作为依赖管理器。

这里没有一个现有的答案能解决我的问题。为我解决这个问题的方法如下。

First, I noticed that the build error pointed out one framework in particular. Next I filtered App Target > Build Phases for that framework. I noticed that that framework was present in both "Link Binary With Libraries" and "Embed Frameworks". Noting that none of the frameworks listed under "Embed Frameworks" were ones managed by Carthage I removed the framework in question from "Embed Frameworks". I then re-built my project and everything works fine including the functionality enabled by the framework in question.

我有同样的问题,但与头文件。

在这种情况下,解决方案是将标题从“公共”部分移动到“项目”部分。