executeFetchRequest:error: A fetch request must have an entity

My issue is I didn't use the same name for Entity and Class. Trivial solution to fix it is by giving them the same name.


If you are using MagicalRecored with Swift:

Make sure you use @objc directive in the Swift NSManagedObject subclass to make the class accessible to Objective-C code from the MagicalRecord library

@objc(MyEntity)
class MyEntity: NSManagedObject {
    @NSManaged var myAttribute: Int16
}

After searching all over for a solution, what fixed it for me was doing a Clean/Build in Xcode.

Product->Clean, Product->Build, then try running it.