I had the same problem. Here are the steps I used to solve it:
Right-click on your project file in Xcode and select ‘Show in Finder‘.
Right-click on your .xcodeproj and select ‘Show Package Contents‘.
Right-click on the project.pbxproj and open it with TextEdit (or any text editor you prefer).
Search for "/* Begin XCVersionGroup section */".
In my case, I had 2 entries for the .xcdatamodeld file in the XCVersionGroup section. I deleted the first one, which was not accurate (had only one child version, whereas my .xcdatamodeld should have had 3 .xcdatamodel versions), saved the file, and this fixed it for me.