5

I'm using Sync Services in my application. I'm using the normal way of getting the contacts from the address book (using sync services).

I want to prematurely end a sync session if the user decides to do that, therefore, when the user presses the "cancel" button, I make a call to [driver finishSyncing]

Attached to the ISyncSessionDriver is a delegate which deals with delegate methods typical of a sync session. One of those methods is - (BOOL)sessionDriver:(ISyncSessionDriver *)sender willFinishSessionAndReturnError:(NSError **)outError

The problem is that when calling finishSyncing, the sessionDriver:willFinishSessionAndReturnError: gets repeatedly called, not just once, but hunderds of times. Eventually it will throw an error.

So, how could I fix this, or what better debugging can I do to figure out what the problem is?

Thanks

Alex
  • 7,432
  • 20
  • 75
  • 118

1 Answers1

3

Use instead - (void)cancelSyncing.

Make sure to release the receiver soon afterward because you cannot continue using a canceled session.

CristiC
  • 22,068
  • 12
  • 57
  • 89
  • The problem is that `cancelSyncing` doesn't immediately close the local sync session, which is my goal right now. – Alex Jun 13 '11 at 10:10
  • I was thinking that you wanted to finish immediately. But you could wait until it finishes and display a message to the user as so. – CristiC Jun 13 '11 at 10:57
  • That's true, and that's what I'm doing as a temporary solution right now. However, if the user has hundreds of contacts in their Address Book, the local sync will take minutes before it ends...not really user friendly. I was "hoping" that someone else has had the same problem and knew of a way to solve it. – Alex Jun 14 '11 at 08:11