Object is not reachable from this managed object context
Object is not reachable from this managed object context
- Subject: Object is not reachable from this managed object context
- From: Lakshmi Vyasarajan <email@hidden>
- Date: Thu, 16 Oct 2008 16:43:48 -0700
Hello,
I am developing an application that imports / synchronizes data from a
web service . I have a worker thread performing the poll / sync
routine. After I do the sync I refresh the main thread by calling
mergeChangesFromContextDidSaveNotification.
I get an exception with reason [Object is not reachable from this
managed object context]. In the following code, saveComplete is the
handler for NSManagedObjectContextDidSaveNotification.
-(void)saveComplete:(NSNotification *)notification{
[self performSelectorOnMainThread:@selector(saveOnMain:)
withObject:notification waitUntilDone:YES];
}
-(void)saveOnMain:(NSNotification *)notification{
NSLog(@"Refreshing main thread");
NSManagedObjectContext * appContext = [[NSApp delegate]
managedObjectContext];
[appContext lock];
@try{
[appContext
mergeChangesFromContextDidSaveNotification:notification];
}@catch(NSException * exception){
NSLog([exception reason]);
@throw;
}@finally{
[appContext unlock];
}
NSLog(@"Refresh suceeded");
}
I could not find any references to this error leading me to believe
that I am doing something completely wrong and I have no clue what it
is.
Thanks in advance,
Lakshmi.
_______________________________________________
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