I was planning to use ASIHttprequest to download an mp3 file. i will need to use queues because there can be multiple simultaneous downloads.
I saw that you can use
[request setShouldContinueWhenAppEntersBackground:YES];
if you want to support background execution... If the file completes in the background, how can i handle this?
will the delegates be called anyway? can i make one of those notification badges from the delegate if the app was in background whenn the delegate was called?
PS: I AM on iOS4, and background exec is supported.
The
requestFinished
method should still be called before theendBackgroundTask:
is called on the download; however, to ensure the functionality you want gets executed (a notification badge or something), you should use aUIBackgroundTask
.Basically the idea is that you create a new background task and use
beginBackgroundTaskWithExpirationHandler:
in the delegate finished method and then do whatever you want in the background task (see the apple dev guide about it here).Make sure you call
endBackgroundTask
on your task after you are done!