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


当前回答

我的问题是在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 12已经弃用了遗留构建系统,它将在进一步的版本中被移除

试试这个吧。 Xcode->File->Project Settings-> Build System -> Legacy Build System。

以防你在使用React Native时遇到这个错误,特别是在使用利比亚oga时。a,看看这条Github评论

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

嗯,就我而言:

如果创建了两个同名的文件,将触发此错误。 删除您最近添加的一个,将解决这个问题。

希望这能有所帮助。

在我的例子中,我添加了GoogleService-Info。plist文件两次失望地到我的Firebase项目。

我先删除添加的GoogleService-Info。Plist,问题解决了。