While building my project for different target I am getting this error:
Could not determine generated file paths for Core Data code generation: Er
In Xcode, select your Model.xcdatamodeld
model and tick the checkbox "Target Membership" for your new target in the Inspector.
Module Inspector > Module > Current Product Module
Clean and Build afterwards.
In my case, I had renamed the directory in which my .xcdatamodel resided, which resulted in the old filename entry not being removed from my Target's Compile Sources
phase.
All I had to do was remove the old file from the Compile Sources
phase, by searching for xcdatamodeld
and removing the relevant (now irrelevant...) entry in my target's Build Phases
tab:
Once you're done, make sure that your actual current .xcdatamodeld file is added to your target. You do this:
a) By clicking on the file in Xcode's Project Navigator (left column -> first icon):
b) And then ticking the boxes of all targets that you want this file to be a part of, in Xcode's File Inspector (right column -> first icon), under Target Membership
:
In my case in File Selector Code Generation was Selected as Swift. As I selected Code generation language as Objective-C. Error Disappeared.
After selecting Objective-C
Product > Clean
and then Rebuild the project.
This worked for me.
Just Clean and Build worked for me after adding Core Data manually (not from the start of the project).