tags:

views:

110

answers:

1

i use now both but i'm not sure which is better. what is exactly the difference? fuzzy question i know. preparing for wwdc

+1  A: 

Sending a cancelAllOperations message to an operation queue cancels all the operations in that queue (that is, it tells the operations to cancel), whereas cancelPreviousPerformRequestsWithTarget: tells the target object to cancel all delayed performs it had previously been told to do.

There is no “better” here; the two methods are incomparable. One cancels NSOperations; the other cancels delayed-perform requests. Which cancellation you use depends entirely on whether you made an NSOperation and put it an NSOperationQueue or sent a delayed-perform request.

Peter Hosey