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 11.4 不能构建旧项目

Xcode => File => Project Settings => Build System => Legacy Build System

其他回答

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

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

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

这是我的错误信息:

error: Multiple commands produce '/Users/runner/Library/Developer/Xcode/DerivedData/slapshot-ios-bpixgzdbgfcmofhguehgrznwbjxl/Build/Intermediates.noindex/ArchiveIntermediates/slapshot-ios-example/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Introspect.framework'
    note: Target 'Introspect-dynamic' (project 'Pods') has create directory command with output '/Users/runner/Library/Developer/Xcode/DerivedData/slapshot-ios-bpixgzdbgfcmofhguehgrznwbjxl/Build/Intermediates.noindex/ArchiveIntermediates/slapshot-ios-example/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Introspect.framework'
    note: Target 'Introspect-static' (project 'Pods') has create directory command with output '/Users/runner/Library/Developer/Xcode/DerivedData/slapshot-ios-bpixgzdbgfcmofhguehgrznwbjxl/Build/Intermediates.noindex/ArchiveIntermediates/slapshot-ios-example/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/Introspect.framework'

我必须添加:linkage =>:static到我的所有目标,而不仅仅是其中的一些,在运行pod deintegrate/pod install之前(归功于这个答案)。

在我的例子中,问题来自podcast文件。我必须将我的测试项目添加到podfile:

target 'MyApp' do
    pod 'Firebase'
    target 'MyAppTests' do
        inherit! :search_paths
        pod 'Firebase'
    end
end

之后,我需要执行:

pod update

对于那些依赖名称相同的Swift头导入的人。(例如:头文件名称:#import "MyApp-Swift.h"):

这个头文件的名称实际上是由${SWIFT_MODULE_NAME}-Swift.h决定的,其中SWIFT_MODULE_NAME使用PRODUCT_MODULE_NAME作为默认值。

此外,还有一个项目范围内的构建设置,名为:SWIFT_OBJC_INTERFACE_HEADER_NAME“Objective-C生成的接口头名称”,它的默认值是${SWIFT_MODULE_NAME}-Swift.h。通过将这个值更改为MyApp-Swift.h,我们聚合构建中的所有目标都能够共享相同的头名称,并且我们能够从它们中更改PRODUCT_MODULE_NAMEvalue。

如果你在核心数据中遇到问题,这个答案适合你。 转到你的文件名。xcdatamodeld并确保所有实体都有manual/None Codegen。