NSEntityDescription random crash
NSEntityDescription random crash
- Subject: NSEntityDescription random crash
- From: Nicolas Lapomarda <email@hidden>
- Date: Thu, 10 Jul 2008 15:56:37 +0200
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 (email@hidden)
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:
This email sent to email@hidden