Xcode 10 Error: Multiple commands produce
Solution 1:
The issue might be occurring because of multiple Plist or other files within App-
Solution -> Open target -> Build phases > Copy Bundle Resources and remove info.plist
from there.
Note: If you have developed a watch app too then you will have to remove the plist from the watch and watch-extension too.
Solution 2:
This answer is deprecated - Xcode 12 has deprecated the Legacy Build System, it will be removed in a further release
I found the solution for this build error, for anybody else having the same issue with Xcode 10 build system, follow the following steps to fix it:
- In Xcode, go to File->Project/Workspace settings.
- Change the build system to Legacy Build system.
It will resolve the build issue with the new Xcode 10.
If you want to work with the new build system, then you can find the troubleshooting help from this apple Xcode help page.
Solution 3:
Go to Xcode -> File ->Workspace Settings. You will find one pop up like.
Select "Legacy Build System" from Build System tag. Press on "Done"
Note:- Make sure clear your project with "cmd+shift+alt+k" and "Derived Data"
Build your project it will work charm :)
Solution 4:
I was experimenting with Core Data. I built a data model for a simple checklist program and generated the NSManagedObjects. When I compiled the project I got the following error:
error: Multiple commands produce '/Users/myUSerName/Library/Developer/Xcode/DerivedData/myCoreDateExperiment-gzbslaqdwglkzxemijpdqmizgyzc/Build/Intermediates.noindex/ myCoreDateExperiment /Debug-iphonesimulator/ myCoreDateExperiment.build/Objects-normal/x86_64/CheckListItem+CoreDataProperties.o':
1) Target ' myCoreDateExperiment ' (project ' myCoreDateExperiment ') has compile command for Swift source files
2) Target ' myCoreDateExperiment ' (project ' myCoreDateExperiment ') has compile command for Swift source files
The problem was the data model (CheckList.xcdatamodeld in my case) was in the "Compile Sources" list. The project compiled cleanly when I removed it from the list.
- Open the project navigator and select the project (very first entry at the top)
- Select your build target under Targets in the "Projects and Targets" pane
- Select Build Phases option near the top
- Expand the "Compile Sources" entry and look for your data model name. Search for "xcdatamodeld" if you have trouble finding it.
- Delete the model from the compile list
- Make sure the data model is included in the "Copy Bundle Resources" list. Add it if it is missing.
EDIT
As @WilliamT. explains in the comments, you need the xcdatamodeld in the compile list. Instead, go to your entities within the xcdatamodeld file. Select the models that are erroring, expand the left panel, and change the field of "Codegen" to "Manual/None".
Solution 5:
This answer is deprecated - XCode 12 has deprecated the Legacy Build System, it will be removed in a further release
Try this as well. Xcode->File->Project Settings-> Build System -> Legacy Build System.