views:

151

answers:

1

This problem follows on from a previous question.

When I run the following line of code:

NSEntityDescription *outputCellEntityDescription = [NSEntityDescription entityForName:@"OutputCell"
                                                               inManagedObjectContext:[[self document] managedObjectContext]];

I get the following error:

HIToolbox: ignoring exception '+entityForName: could not locate an NSManagedObjectModel for entity name 'OutputCell'' that raised inside Carbon event dispatch

My concern is the extra uptick that seems to have appeared at the end of the entity name in the error. Can anyone explain why this might occur or how I could go about debugging it. The code runs as normal when it is first run, but after a few Core Data fetches it seems to break. Could it be a problem related to a memory leak or similar?

Thanks for the help.

+1  A: 

There isn't an extra uptick. You just have nested quotations:

[']+entityForName: could not locate an NSManagedObjectModel for entity name 'OutputCell' [']

This bit is the string returned by the exception. It in turn has OutputCell single quoted. It does look confusing though. If you hadn't seen it before it's easy to miss.

Not sure what is causing the error, however.

Edit:

As a debugging step I suggest logging the results of a call to -[NSManagedObjectModel entities] on your model to see if it does actually contain the OutputCell entity.

A simple explanation for your problem is that the you somehow switch models after you save. Either you accidentally assign a different model or you nil out the model you have. To test for that you should log the address of the NSManagedObjectModel instance and see if it changes.

TechZen
Thanks, should have spotted that one myself.
Ian Turner
Did you solve the original problem?
TechZen
Not yet, been trying for a few days but I'm slowly getting there. It seems to be something related to the Core Data model breaking somewhere when it get's fetched.
Ian Turner
You want to be careful about hitting the checkmarks then. I doubt you'll get any more answers to the previous question because people will think it has been resolved.
TechZen