I have an app that needs to send data (using POST) to a server. This function has to be on one of the NavigationController sub-controllers and user should be able to navigat
I'd like to support the post that mentions:
bgTask = [app beginBackgroundTaskWithExpirationHandler:^{
[app endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
}];
But also point out that you may want to encapsulate your unit of work in an NSOperation subclass as well. This will make it extremely re-useable and, when combined with NSOperationQueue, automatically handle threading and what not. Then later, when you want to change your code, or have it appear in a different location in your app, it will be trivial to move or edit.
One note about using the operation queue, is that in this case you will actually want to send a synchronous url request from within the queue. This will let you not have to worry about concurrent operations. Here is the link that you may find helpful:
http://www.cimgf.com/2008/02/16/cocoa-tutorial-nsoperation-and-nsoperationqueue/