I am downloading large data from ASynchronous NSURLConnection in one separate viewcontroller.it takes 2 minutes to download the data.it works fine. but when i go to background mode through quitting Application,and open again , the splash screen comes and application closed forcely.when download small data, it works fine in background mode in same view controller.I use the follwing code after reading apple's finite length documnet. but it is not working?any help please?
- (void)applicationDidEnterBackground:(UIApplication *)application
{
UIApplication *app = [UIApplication sharedApplication];
bgTask = [app beginBackgroundTaskWithExpirationHandler:^{
[app endBackgroundTask:bgTask];
bgTask = UIBackgroundTaskInvalid;
}];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{});
[app endBackgroundTask:bgTask]; bgTask = UIBackgroundTaskInvalid;
}