NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"Relationship" inManagedObjectContext:context]; [fetchRequest setEntity:entity];
.... Dave On Jan 24, 2012, at 11:40 AM, Laurent Daudelin wrote: > Given the following code: > > NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] > initWithEntityName:@"Relationship"]; > NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%K = %@", > @"parentObject.objectBaseUuid", wallUuid]; > [fetchRequest setPredicate:predicate]; > NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] > initWithKey:@"id" ascending:YES]; > [fetchRequest setSortDescriptors:[NSArray > arrayWithObject:sortDescriptor]]; > self.discussionFRC = [[NSFetchedResultsController alloc] > initWithFetchRequest:fetchRequest managedObjectContext:context > sectionNameKeyPath:NULL cacheName:NULL]; > > I'm getting an exception when trying to create the NSFetchedResultsController: > > 2012-01-24 11:31:12.184 ECXcollaborate[69599:f203] *** Terminating app due to > uncaught exception 'NSObjectInaccessibleException', reason: 'This fetch > request (0x6020240) was created with a string name (Relationship), and cannot > respond to -entity until used by an NSManagedObjectContext' > > The same code runs fine under iOS 5. Anybody has any idea on how to > workaround that problem? I need the fetch request to create the fetched > results controller and if I believe the exception description, I would have > to have the managed object context do a fetch with the fetch request so that > I can then use it to create the fetched results controller and do a fetch > again? That seems rather counter-productive. > > Comments? Ideas? > > -Laurent. > -- > Laurent Daudelin > AIM/iChat/Skype:LaurentDaudelin > http://www.nemesys-soft.com/ > Logiciels Nemesys Software > laur...@nemesys-soft.com > > _______________________________________________ > > 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: > https://lists.apple.com/mailman/options/cocoa-dev/davedelong%40me.com > > This email sent to davedel...@me.com _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com