MACOSX - When calling -finishSyncing on an ISyncSessionDriver the app makes repeated calls to the delegate

88 Views Asked by At

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

1

There are 1 best solutions below

3
CristiC On BEST ANSWER

Use instead - (void)cancelSyncing.

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