I\'m working on an app that monitors significant location changes in the background. I\'ve been reading all the answers (well, I think all!) about ios4 and the application l
Yep. You can do your network processing based on significant change events.
When you get woken up into the background state on significant change (from terminated or suspended state), you can make your http request. If you find your app is being terminated before you finish your HTTP request, you can ask for additional background processing time via the beginBackgroundTaskWithExpirationHandler: method on UIApplication.
I spent a fair bit of time on short train trips to test this out. :)
I'd just like to confirm RedBlueThing's answer with some detail.
I now use the following to accomplish this. bgTask is declared as UIBackgroundTaskIdentifier
bgTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:
^{
[[UIApplication sharedApplication] endBackgroundTask:bgTask];
}];
// Now call methods doing network activity
// ...
// WHEN I KNOW THE LAST ACTION HAS COMPLETED USE THIS BLOCK OF CODE
if (bgTask != UIBackgroundTaskInvalid)
{
[[UIApplication sharedApplication] endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
}
Hope this helps out since I see quite a few people looking at the question.