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

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -