Soon after the main nib has been loaded, I need to execute a fetch request. Now as the title says, the crash is "random": sometimes the app executes just fine, sometimes it crashes.

When it does crash, here is where it happens:

[NSEntityDescription entityForName:anEntityName inManagedObjectContext:managedObjectContext]

The error I'm getting is random as well, but always takes the form

"*** -[NSCFString _entityForName]: unrecognized selector sent to instance xxx".

What changes launch after launch is the name of the class I'm supposedly sending the message to. I've seen NSCFString, NSCFArray, _NSPlaceholderTextFieldPlugin and other exotic class names...

I've also tried getting the entity description with the equivalent code below...

NSManagedObjectModel *managedObjectModel = [[managedObjectContext persistentStoreCoordinator] managedObjectModel]; NSEntityDescription *entity = [[managedObjectModel entitiesByName] objectForKey:anEntityName];

... but the equivalent problem occurs ("*** -[NSCFString entitiesByName]: unrecognized selector sent to instance xxx").


The code above is executed in a method called from -awakeFromNib. As the nib file contains tree / array controllers that query the same managedObjectContext, I've tried delaying the execution of my method using performSelector:withObject:afterDelay: but it didn't seem to help.

Is NSEntityDescription acting crazy or am I?

Nick
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to