cocoa touch - How to get Web service response in an iOS app when application is in Background? -
i working on ios application in using restful web service nsurlconnection, when phone call web service , after calling web service press home button application goes in background , not getting response in background. in application response should when application in background state.
so please suggest me suitable reply this.
should utilize nsurlsession ?
nsurl *myurl = [nsurl urlwithstring:@""]; // set url here nsurlsession *session = [nsurlsession sharedsession]; nsurlsessiondownloadtask *gettask = [session downloadtaskwithurl:myurl completionhandler:^(nsurl *location, nsurlresponse *response, nserror *error) { // stuff result }]; // don't forget start task [gettask resume];
here's nice tutorial might want take: http://www.raywenderlich.com/51127/nsurlsession-tutorial
ios cocoa-touch background nsurlconnection nsurlsession
No comments:
Post a Comment