Invalid redeclaration on CoreData classes

dpstart picture dpstart · Nov 3, 2016 · Viewed 13.8k times · Source

I am working with CoreData, on an entity called "RoleName".

The problem is: I click on "Create NSManagedObject subclass" from within my model, and so it automatically creates the classes for my entity.

However, on the declaration of the class, I get this error:

Invalid redeclaration of "RoleName"

even though I don't have any other class with the same name.

Answer

Deepukjayan picture Deepukjayan · Nov 29, 2016

This is because Xcode handles all that by itself. I felt it like a bit of trouble as the auto generated classes don't have all my properties.

So follow these steps to get this as it used to be:

  • Delete what ever classes you already made for core data.
  • Set class.Module as Current Product module enter image description here

  • Set Class.codegen as Manual/None

enter image description here

  • Now select your entity and create NSmanagedobject subclass enter image description here

  • You are all set