I have been searching for literally weeks to try to find an answer, or an example of how to do this.
All the examples/tutorials for NSURLConnection show it starting in the foreground or starting in the background, ditto all the examples for beginBackgrounTaskWithExpirationHandler: show how to start a background task after entering the background.
As far as I can tell there is nothing out there on the internet or books that shows how to start a connection while in the foreground and then if its not finished continue it in the background.
The answer to this question does not actually answer the question:
If you read the referened Beyond The Basics section it says: "While the app is in the foreground the background task won't have any effect". This means it is not possisble to start a background task using NSURLConnection while in the foreground if you want to download in the foreground.