开发者

Problem with the name of an NSEntityDescription

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: ignorin开发者_开发知识库g 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜