Xcode 在为 watchos 和 today extension 构建时多个命令产生错误

Xcode multiple commands produce error when building for watchos and today extension

我正在尝试为我的 iOS 应用程序创建 watchOS 和 today 扩展。我已经通过 SPM 将 Realm 和 RealmSwift 添加到 watch 应用程序,并且我正在使用 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

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

我检查了我的构建设置,在任何目标中都没有重复的文件。

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

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