• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Recovering from a merge conflict
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Recovering from a merge conflict


  • Subject: Recovering from a merge conflict
  • From: Paulo Andrade <email@hidden>
  • Date: Tue, 21 Dec 2010 14:36:21 +0000

Hello,

I have an application using Core Data that has to import/update some data to/in the database.

It imports in batches and it conflict may happen. Some object being updated in a batch might also be updated in another context.

This is fine and I'm aware that this will happen. What I want to do is start this batch from the beginning.

The problem is that I cannot make NSManagedObjectContext forget about the merge error!

The code is something like this
===

// at this point all [moc hasChanges] is NO

int tries = 10;
while ( tries-- ) {
	// compute this batch

  [moc save:&error];
  if (error != nil && [error code] == NSManagedObjectMergeError) {
   [moc rollback];
   NSLog(@"Got optimistic locking error %@\n. Retrying...", [error description]);
   continue;
  } else {
   break;
  }
}
==

It seems rollback isn't enough, iterating over [moc updatedObjects] and calling refreshChanges:mergeObject: also doesn't work.


1- So how can I mark a conflict as resolved?

2- Why is the NSMergeConflict object private? Is the only way to find which object caused the error is to print that object and look at that message?


_______________________________________________

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

  • Follow-Ups:
    • Re: Recovering from a merge conflict
      • From: Fritz Anderson <email@hidden>
  • Prev by Date: Re: Text rendering/editing on OSX & iOS
  • Next by Date: Improving drawing of UIView with many many Subviews
  • Previous by thread: Re: Text rendering/editing on OSX & iOS
  • Next by thread: Re: Recovering from a merge conflict
  • Index(es):
    • Date
    • Thread