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


当前回答

2022的答案

如果您有多个目标,请确保部署目标相同。

其他回答

删除该死的资产文件

解决方案->打开目标->构建阶段>复制Bundle资源并从那里删除资产。

检查您支持的平台!

我们花了几个月的时间来研究这个问题。我们发现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 -> File ->Workspace Settings。 你会发现一个突然出现的。

从Build System标签中选择“Legacy Build System”。 按“完成”

注意:-确保用“cmd+shift+alt+k”和“Derived Data”清除你的项目

建立你的项目,它将工作的魅力:)

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

在创建框架时也会遇到此错误。

在你的框架项目中,如果你有应用目标,并且在部署信息部分为每个应用目标设置了不同的iOS版本,那么进行pod安装将为相同的pod创建一个带有iOS版本后缀的新目标。

您可以通过转到pods目标来检查这一点。如果你看到重复,那就是你的问题。Xcode get因此感到困惑,并抛出一个这样的错误。

Multiple commands produce '/Users/userName/Library/Developer/Xcode/DerivedData/ProjectName-fbeqffupediuiedlrplqjyhgyqna/Build/Products/Production-iphoneos/XCFrameworkIntermediates/SomePodFramework':
1) That command depends on command in Target 'SomePodFramework-iOS10.0' (project 'Pods'): script phase “[CP] Copy XCFrameworks”
2) That command depends on command in Target 'SomePodFramework-iOS13.0' (project 'Pods'): script phase “[CP] Copy XCFrameworks”

以下是你需要做的。

将所有目标的部署信息下的最小ios版本设置为相同。这将确保当你安装pod时,cocoapods不会根据多个ios版本创建同一个pod的新目标。 关闭你的工作空间。删除xcworkspace, Podfile。锁和Pods文件夹。 运行pod install。

现在,当您打开工作区时,您可以再次检查pod目标。你会发现没有重复。

现在只需更改所有目标的部署信息。