Search code examples
swiftxcodecocoapodsswift-package-manager

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


I'm trying to create a watchOS and today extension for my iOS app. I've added Realm and RealmSwift to the watch app through SPM, and I'm using cocoapods to add AppCenter to the iOS app. I ran the iOS app fine, and built the today extension fine. Then, when I try to run the watchos app, it gives me this error:

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

I've tried cleaning the build folder, deleting derived data, and reinstalling pods and packages. It also happens even if I don't have any packages installed. It will only build again if I delete both the today extension and the watch app from the targets.

I've gone through my build settings and there's no duplicate files there in any of the targets.

I can't find what is causing the duplicate file, it seems like it's being generated from somewhere I can't find.


Solution

  • I've figured it out. I had set the today extension's front name to the same name as the main iOS app. Apparently this made it so the compiler was making two of the same named apps. I fixed it by changing the today extension's name.