0

I have a CoreData entity (named Canvas)which contains an attribute: selectedCardID of type UUID?.

My CoreData entity is managed by my own NSManagedObject Subclass with the following line:

extension Canvas {

    @NSManaged public var selectedCardID: UUID?

}

When attempting to set a value to selectedCardID I get the following error

"Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Cannot set value for attribute with undefined type: property = "selectedCardID"; entity = "(<NSEntityDescription: 0x2823f0160>) name Canvas

I don't understand what the error message means by undefined type when I've added UUID? to to both the subclass and xcdatamodel file.

Any help would be greatly appreciated.

santi.gs
  • 514
  • 3
  • 15
  • 2
    `@NSManaged public var selectedCardID: String?` – Shehata Gamal May 18 '21 at 13:50
  • UUID is certainly a valid type for Core Data. Did you add it now, maybe you simply need to clean your build folder and/or remove the project folder under DerivedData so that Xcode is not using an old version when building. – Joakim Danielson May 18 '21 at 14:39
  • @JoakimDanielson I've tried that but to no avail. For now converting between `uuidString` and `UUID` as recommended by @Sh_Khan seems to work fine for me. – santi.gs May 18 '21 at 14:53
  • Could you explain how you set it? I use UUID in several places in my current project although not as an optional attribute if that could be relevant. – Joakim Danielson May 18 '21 at 15:09
  • Is there any more to that error message? It seems like that's only part of what it would say. – Tom Harrington May 18 '21 at 17:01

0 Answers0