Swift – CoreData: warning: Unable to load class named

By admin | Uncategorized
11 Feb 2015

I was stupid enough to name my new Swift testbed Application Fire!, with an exclamation mark at the end. This gets replaced into an underscore inside the Xcode project:

lazy var managedObjectModel: NSManagedObjectModel = {
// The managed object model for the application. This property is not optional. It is a fatal error for the application not to be able to find and load its model.
let modelURL = NSBundle.mainBundle().URLForResource("Fire_", withExtension: "momd")!
return NSManagedObjectModel(contentsOfURL: modelURL)!

When creating a NSManagedObject subclass from the Model definition in Fire_.xcdatamodel I had to name it Fire_.FiringSetupto get it to work.
Screen Shot 2015-02-10 at 23.13.43

Comments are closed.