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


当前回答

实际上,你可以使用遗留的构建系统,但你不会得到快速的构建时间,即你不会得到新的构建系统的功能,已经在XCode10默认。这只是一个没有得到最新的构建功能https://developer.apple.com/documentation/xcode_release_notes/xcode_10_release_notes/build_system_release_notes_for_xcode_10的解决方案

其他回答

我是IOS开发的新手,我尝试了上面的答案,但它们对我不起作用。

我的XCode版本是12.4,Swift 5

我得到多个命令产生错误,而构建

我试图从错误列表中扩展错误,但双击它没有做什么,所以首先,我很难知道完整的错误。

所以我右键单击错误并复制到剪贴板,粘贴在文本编辑器中。

它显示了完整的错误

上面说哪部分有问题

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

(我正在使用谷歌Firebase)

我很惊讶地看到,这些pod是为两个不同版本的iOS(12.3和14.1)编译的。

我发现,在活动目标配置中,我在部署信息部分设置了iOS 12.3,在项目级别信息选项卡的部署目标中设置了14.1

将两者设置为相同的所需版本,然后清理和构建解决了这个问题。

请让我知道设置2个不同的版本是否是一个错误。如果这不是一个错误,那么应该怎么做呢?

不允许我将构建系统设置为遗留系统 信息。plist在Copy Bundle Resources阶段不存在

对于那些依赖名称相同的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。

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

这基本上意味着你有多个名为Info.plist的文件; 通常情况下没问题,但你的文件被设置为相同的目标会员。因此,修复方法是:单击每个文件并在右侧检查它们的目标成员,确保它们不重叠。

在检查构建日志时,我注意到一个警告:

note: Using new build system
note: Planning build
note: Constructing build description
Build system information
warning: The Copy Bundle Resources build phase contains this target's Info.plist file '/Users/<redacted>/Repositories/Whitesmith/optimize-ios/Carthage/Checkouts/WSStatusBarNotification/Miscellaneous/Info.plist'. (in target 'JDStatusBarNotification')

如果这是你的情况,那就去你的目标:

构建阶段 拷贝包资源 删除info.plist。