iphone - Best way to process multiple HTTP async requests in the background and return responses individually -


i have 1 class processes requests composing framework, https://github.com/ivasic/restframework. want able execute requests requests , return responses individually caller. stands if have more 2 request, result of second 1 domes not come through, seems happen @ same time.

what solution this?

you have caller pass block "one class handles requests." caller block can response.

// inside caller class. oneclassthathandlesrequests *ws = [oneclassthathandlesrequest sharedinstance]; [ws getfromurl: @"http://webservice.com/people/jack" completionblock: ^(urlrequest *request , urlhttpresponse *response, nsdata *data) {         // make sure we got 200 code back.         // change data json if i'm getting json back.         }]; 

now oneclassthathandlesrequests knows how pass information call without oneclassthathandlesrequests needing know called.

you use delegate pattern, blocks case makes more sense me


Comments

Popular posts from this blog

Eclipse formatter for java ending braces -

ruby - Nesting modules inside of a Rails eninge gem -

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -