Scrungepipes
Scrungepipes

Reputation: 37581

How should beginbackgroundtaskwithexpirationhandler: be dealt with for an NSUrlConnection that is already in progress?

If the application uses NSURLConnection to start a download while the app is in the foreground, but then the app moves to the background before the data has finished downloaded, then how should the app make use of beginbackgroundtaskwithexpirationhandler: for this already existing connection?

There's plenty of reference material available showing how to use NSURLConnection initWithRequest: to START a download AFTER the app has moved into the background, there is nothing showing how to deal with the situation where NSURLConnection initWithRequest: has already been called while the app is in the foreground but hasn't yet finished when the app moves into the background and how to continue.

TIA

Upvotes: 4

Views: 2005

Answers (1)

user523234
user523234

Reputation: 14834

You need to start it as a background task for task that you wish to continue in background even if that task is in foreground beginning with. Check out the section "beyond the basics" in this Apple doc: https://developer.apple.com/library/ios/ipad/#technotes/tn2277/_index.html

Upvotes: 7

Related Questions