For example, one UIViewController
requests data using AFNetworking on appear event and perform some actions on result receiving. These actions are defined in a block which I give to a request object as a param.
Now I want to add a button which will push another view controller. This view controller will use the same data which the first view controller already uses.
The problem is I don't need to resend the same request for the second one but I'll have some issues with it: 1)I can't set its params directly on request completion because the second view controller may not exist yet 2)If the second one is currently displayed then should I handle the data in the first one?
To handle requests I create NSURLSessionTask
object and call showAlertViewForTaskWithErrorOnCompletion:delegate:
. It is just two strings of code so I think it is not necessary to post it.