for resolving this one you can add notification and when app going to background process at that time pass the nil value to web view.
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(handleEnteredBackground:)
name: UIApplicationDidEnterBackgroundNotification
object: nil];
or place below code in applicationDidEnterBackground
method it freezes the all the tasks untill comes to foreGround
process.
UIApplication *app = application;
[app beginBackgroundTaskWithExpirationHandler:^{
// Synchronize the cleanup call on the main thread in case
// the task actually finishes at around the same time.
dispatch_async(dispatch_get_main_queue(), ^{
// if (bgTask != UIBackgroundTaskInvalid)
// {
// // [app 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.
// Synchronize the cleanup call on the main thread in case
// the expiration handler is fired at the same time.
dispatch_async(dispatch_get_main_queue(), ^{
});
});