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];
        [EMAIL PROTECTED](NSException * exception){
        
                NSLog([exception reason]);
                @throw;
        [EMAIL PROTECTED]
                        [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 (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