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中有一个错误。


当前回答

在我的例子中,清理被剥夺的数据和构建设置(按此顺序),重新启动Xcode和模拟器有帮助。

我试图做解决方案->开放目标->构建阶段>复制捆绑资源,但它再次出现在那里。清理被剥夺的数据有帮助。在错误中,它显示了副本的位置,在我的情况下,它说它在我的应用程序包和被剥夺的数据中。

其他回答

在开始之前,请注意我的项目使用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.

检查您支持的平台!

我们花了几个月的时间来研究这个问题。我们发现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开发,你将需要更新你的配置。

我的问题是在Mojave中运行Xcode 10,并且在尝试运行我在更新到Xcode 10之前编写的单元测试时。

在我的例子中,我在运行TestTarget目标时遇到了这个问题。为了解决这个问题,我必须:

删除一个目标依赖项(在TestTarget >构建阶段>目标依赖项中)

因为除了我的TestTarget,我还有另外两个目标,它们都在运行相同的脚本,并在某个点上创建/复制文件。

这与Xcode 10 Build System Release Notes中提到的内容相冲突:

对于由多个构建命令生成的构建中的任何单个文件,都是错误。例如,如果两个目标各自从shell脚本阶段声明相同的输出文件,则将输出文件的声明分解到单个目标中。

新的更新后,我更新Xcode 10.1到10.2

我更新到Xcode 10.2后又出现了类似的问题。我有多个目标在通过项目:Target1和Target2,我解决了这个问题:

导航到编辑方案>构建和 从构建的目标中移除一个:取消Test下Target1的复选框,因为我知道Target2导入了Target1

还要注意的是,Target2的复选框在Test下保持选中状态

选择您的方案(左上角)->编辑方案…->构建(左标签)->取消“查找隐式依赖”

在此之后,您可能需要修复目标未显式导入的任何依赖项。

转到Xcode 10,错误像

error: Multiple commands produce '/Users/uesr/Library/Developer/Xcode/DerivedData/OptimalLive-fxatvygbofczeyhjsawtebkimvwx/Build/Products/Debug-iphoneos/OptimalLive.app/Info.plist':

可解如下:

进入Xcode->File->Workspace/Project Settings-> Build System -> Legacy Build System。