When a user first opens my app, I need to download and install some content from a server before they can begin using the app. The problem is that this takes around 5 minutes on wifi, during which time the app goes into the background and the download is suspended.
Is there any way to either:
- prevent an iOS app from entering the background whilst I perform my download
- or continue peforming the task in the background (i.e. perform the task irrespective of whether the app is in the foreground or background)
Thanks
It really doesn’t matter, if the user presses the home button it will go to background. Although you can do two things to mitigate the problem:
beginBackgroundTaskWithExpirationHandler, to give you a bit more time to download. Which you can read here.[UIApplication sharedApplication].idleTimerDisabled = YES;. You can read more about that here.Either way, the best thing you can do is to tell the user, that is an important download and he shouldn’t quit the application.