首页 > 解决方案 > 为 watchos 和今日扩展构建时,Xcode 多个命令会产生错误

问题描述

我正在尝试为我的 iOS 应用程序创建一个 watchOS 和今天的扩展。我已经通过 SPM 将 Realm 和 RealmSwift 添加到手表应用程序中,并且我正在使用 cocoapods 将 AppCenter 添加到 iOS 应用程序中。我很好地运行了 iOS 应用程序,并很好地构建了今天的扩展程序。然后,当我尝试运行 watchos 应用程序时,它给了我这个错误:

Multiple commands produce '/Users/me/Library/Developer/Xcode/DerivedData/App-grfodydruvgwoxaiuyovwnrntjnz/Build/Intermediates.noindex/Previews/App/Products/Debug-iphonesimulator/App.swiftmodule/x86_64-apple-ios-simulator.swiftmodule':
1) Target 'App Today' (project 'App'): Ditto /Users/me/Library/Developer/Xcode/DerivedData/App-grfodydruvgwoxaiuyovwnrntjnz/Build/Intermediates.noindex/Previews/App/Products/Debug-iphonesimulator/App.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/me/Library/Developer/Xcode/DerivedData/App-grfodydruvgwoxaiuyovwnrntjnz/Build/Intermediates.noindex/Previews/App/Intermediates.noindex/App.build/Debug-iphonesimulator/App Today.build/Objects-normal/x86_64/App.swiftmodule
2) Target 'App' (project 'App'): Ditto /Users/me/Library/Developer/Xcode/DerivedData/App-grfodydruvgwoxaiuyovwnrntjnz/Build/Intermediates.noindex/Previews/App/Products/Debug-iphonesimulator/App.swiftmodule/x86_64-apple-ios-simulator.swiftmodule /Users/me/Library/Developer/Xcode/DerivedData/App-grfodydruvgwoxaiuyovwnrntjnz/Build/Intermediates.noindex/Previews/App/Intermediates.noindex/App.build/Debug-iphonesimulator/App.build/Objects-normal/x86_64/App.swiftmodule

我尝试清理构建文件夹、删除派生数据以及重新安装 pod 和包。即使我没有安装任何软件包,它也会发生。只有当我从目标中删除今天的扩展程序和手表应用程序时,它才会再次构建。

我已经完成了我的构建设置,并且在任何目标中都没有重复的文件。

我找不到导致重复文件的原因,似乎它是从我找不到的地方生成的。

标签: swiftxcodecocoapodsswift-package-manager

解决方案


我已经想通了。我已将今天的扩展名设置为与主 iOS 应用程序相同的名称。显然,这使得编译器制作了两个相同名称的应用程序。我通过更改今天的扩展名来修复它。


推荐阅读