I am attempting to test my application's interaction with CoreData using an in-memory store, but the code crashes when I attempt to cast the object given from this call:
let newEntity: AnyObject = NSEntityDescription.insertNewObjectForEntityForName("File", inManagedObjectContext: moc)
let newFile = newEntity as RSFile
RSFile
is set properly in the Class field of the core data model and included in , and this code works fine in the normal application. I have checked that the Managed Object Model is being properly created, and everything seems to be setup properly, but I end up in the machine code with a "dynamic cast failed"
string a few lines above the breakpoint.
Additionally, if I cast newEntity
to an NSManagedObject
and place a breakpoint so that I can inspect it at runtime, everything appears valid there, so the issue is solely with the cast. I've looked at other suggestions but I can't find anything missing from my configuration. Any ideas as to what could be going wrong?
Aucun commentaire:
Enregistrer un commentaire