SugarRecord icon indicating copy to clipboard operation
SugarRecord copied to clipboard

NSManagedObjects subclass with a different class name

Open nicolettemanas opened this issue 8 years ago • 1 comments

What

I have an Entity named Transaction. I generated an NSManagedObject subclass and named it TransactionManagedObject since I already have an existing Transaction (NSObject) class.

I tried fetching data from it using:

try! context.request(TransactionManagedObject.self).filtered(with: "id", equalTo: id).fetch()

However, I am getting the following error:

caught "NSInternalInconsistencyException", "NSFetchRequest could not locate an NSEntityDescription for entity name 'TransactionManagedObject'"

It works fine with managed object classes with the same entity name.

Context

I am using SugarRecord 3.0.0 in Swift3 with CoreData

nicolettemanas avatar Feb 27 '17 14:02 nicolettemanas

@nicolettemanas are you sure that you have initialized the storage with the Core Data model where the TransactionManagedObject is? It looks like Core Data is trying to find the entity but it's not defined in the data model that you passed during the setup.

pepicrft avatar Apr 07 '17 13:04 pepicrft