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

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

其他回答

如果你的应用程序生成了与多个.app文件相关的错误,那么从“复制bundle资源”中删除。plist文件将不起作用。

如果该错误与.app文件有关,请执行以下步骤

Select the Target. Go to Build Phases tab. Remove the items listed in Output Files Compile the code if it compiles successfully then not follow the next steps. If code does not compile successfully and Xcode may give you an error related to "Library not found". Then add the missing library in General Tab in Linked Frameworks and Libraries that Xcode mentioned in the error. Keep adding these libraries (that Xcode ask through compile errors) in Linked Frameworks and Libraries until the code compiles successfully. Hope this helps.

如果您手动创建实体的CoreDataClass和CoreDataProperties,请确保转到您的xcdatamodel并将检查器选项卡中的Codegen设置为“Manual/None”。如果设置为“类定义”,Xcode会自动为你创建一个重复的类。

我的问题是在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下保持选中状态

我在plist上也有同样的问题。 结果我有两个副本,一个是空的,一个在我的本地化资源文件夹中。 去掉其中一个(空的)就解决了这个问题。

如果你检查你的错误,行1)和2)有不同的路径。在复制阶段,这个文件可能定义了两次。

检查你的目标属性,构建阶段,拷贝Bundle资源,并寻找一个重复的info.plist。找出不正确的路径并删除它。(您可能还想从文件系统中删除它。)

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