I’m working on a project that interfaces with Google Data APIs. I have several independent classes for HTTP GET and HTTP POST for interacting with Google, and they are all asynchronous. I’m concerned that a user might touch the home button before operations are finished, thus causing rifts in server/client sync parity. I don’t understand the background task API, as it seems that I have to encapsulate every single GET or POST request in a background block, and each block has to be called from my Application Delegate. Is this true? If so, it would cause a major headache to try to rewrite a lot of my existing upload and download logic.
Thanks for your input! =)
I recommend to queue all the HTTP Requests using a
NSOperationQueueand then only use one background task. You can specify how many operations are allowed to run in parallel withsetMaxConcurrentOperationCount.When you use ASIHTTPRequest framework, this is very easy with ASINetworkQueue, a subclass of
NSOperationQueue.Continuing downloads in the background is easy too: http://allseeing-i.com/ASIHTTPRequest/How-to-use#background_downloads_ios.