I've got an issue that just completely bewilders me. I've created a NSManagedObject subclass via the 'Editor' Menu in Xcode whilst in my .xcdatamodeld file. I've inserted a line in my program that fetches an object and sets it as the correct type, which is called Assignment
. When the program loads up, it crashes on the line where I assign the object. The class is as follows:
import Foundation
import CoreData
class Assignment: NSManagedObject {
@NSManaged var completedDate: NSDate
@NSManaged var dueDate: NSDate
@NSManaged var name: String
@NSManaged var notes: String
@NSManaged var teacher: String
@NSManaged var type: String
}
Here is the line that the program crashes on:
let assignment: Assignment = fetchedResultsController.objectAtIndexPath(indexPath) as! Assignment
I can't say I've tried anything to fix this, as the error isn't all that much help:
2015-05-02 23:48:22.435 myHomework[14188:744047] CoreData: warning: Unable to load class named 'PRODUCT_MODULE_NAME.Assignment' for entity 'Assignment'. Class not found, using default NSManagedObject instead.
Could not cast value of type 'NSManagedObject_Assignment_' (0x7feec15263b0) to 'myHomework.Assignment' (0x10fb58370).