Add tag and operation started block to AFURLConnectionOperation. #708

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants

Tags are useful to keep track of different requests inside a NSOperationQueue. The requests started block is a handy replacement for the AFNetworkingOperationDidStartNotification as it is a lot easier to assign individual actions to each operation using a block rather than a NSNotification.

Jonas Gessner Added tags and a operation started block to AFURLConnectionOperation
This is very useful when handling several requests in a
NSOperationQueue. Tags are very useful to identify requests and save
metadata in NSDictionaries for displaying progress and more visually
(ex. UITableView).
39f1768
Contributor

blakewatters commented Dec 31, 2012

I think the support for a userInfo dictionary that was merged in 732cd2d covers the use case for your tag property. You can also handle taking an action when the operation begins execution using KVO on the isExecuting key path.

Contributor

mattt commented Dec 31, 2012

+1 @blakewatters. userInfo gives you everything you need to disambiguate between different requests on some arbitrary criteria.

As far as determining which operation is receiving data for download progress, upload and download progress blocks can strongly reference the weakly-captured operation instance—no need for another parameter there.

mattt closed this Dec 31, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment