I tried to save data and merge using CoreData and a multi-threaded application for the iPhone. But I can not get the managed objects in the main thread after the merge.
I wrote the code like this:
[managedObjectContext performSelectorOnMainThread:@selector(mergeChangesFromContextDidSaveNotification:)
withObject:notification
waitUntilDone:YES];
[self performSelectorOnMainThread:@selector(didMerged:) withObject:objectIds waitUntilDone:YES];
So, I tried passing objectIds to get the NSManagedObject instances in the main thread that were generated in another thread. At first I tried the "objectWithId" method, but it generated failure objects. Then I tried the "existingObjectWithID" method, but partially generated the objects, and the others were zero with the following error:
[Error] Error Domain=NSCocoaErrorDomain Code=133000 "Operation could not be completed. (Cocoa error 133000.)"
What's wrong? Is there a way to restore all objects using objectIds after merging in another thread?
Thank.