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


当前回答

我在用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”。

其他回答

在我们的例子中,我们只是清理了“Copy Bundle Resources”中的任何碎片,只留下最小的项目。

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

这里提出的解决方案没有一个对我有效。这主要归功于CocoaPods。我以前使用Cocoapods 1.3.1。简单地升级到1.5.3并不能立即解决这个问题。

我遵循的步骤是:

删除Podfile.lock 删除Pods目录 删除派生数据并清除 退出Xcode 将CocoaPods更新到1.5.3 运行pod安装 打开工作区和构建

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

搜索并删除由多个命令产生的重复文件。

这里,一个额外的信息。应该删除plist文件(在我的情况下,它是Contents.json)

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