I would like to set UIWebview
always running on background.
UIWebview
is not working when iPhone entered 'applicationDidEnterBackground
'.
so I want UIWebview
to run always on backgroud.
Is it possible?
Asked
Active
Viewed 1,648 times
0

Sean
- 29
- 1
- 6
-
I think [this link][1] may help you. [1]: http://stackoverflow.com/questions/5323634/ios-application-executing-tasks-in-background – Mathew Varghese Oct 29 '12 at 08:23
1 Answers
2
Every app can continue to execute in the background for roughly 10 minutes before it terminates. Only certain apps can continue to execute in the background, such as audio/gps/bluetooth etc related apps. You can find out more here.
The following code sample is from the app doc and can help you get started -
- (void)applicationDidEnterBackground:(UIApplication *)application
{
bgTask = [application beginBackgroundTaskWithExpirationHandler:^{
// Clean up any unfinished task business by marking where you.
// stopped or ending the task outright.
[application endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
}];
// Start the long-running task and return immediately.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// Do the work associated with the task, preferably in chunks.
[application endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
});
}

yeesterbunny
- 1,847
- 2
- 13
- 17