Re: NSFetchRequest Problem Under iOS 4.3.5
Re: NSFetchRequest Problem Under iOS 4.3.5
- Subject: Re: NSFetchRequest Problem Under iOS 4.3.5
- From: Dave DeLong <email@hidden>
- Date: Tue, 24 Jan 2012 11:54:20 -0800
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 email@hidden
>
> _______________________________________________
>
> 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
_______________________________________________
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