I am working on the app where video is uploading to Facebook. It is working fine till the app is active and also If it goes to background. For background I used following lines of code to not interrupt the connection.
- (void)applicationDidEnterBackground:(UIApplication *)application
{
UIApplication *app = [UIApplication sharedApplication];
self.backgroundTask = [app beginBackgroundTaskWithExpirationHandler:^{
[app endBackgroundTask:self.backgroundTask];
}];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[[UIApplication sharedApplication] endBackgroundTask:self.backgroundTask];
self.backgroundTask = UIBackgroundTaskInvalid;
});
}
But if user locks the screen by pressing on/off button the NSURLConnection get stops. Is there any other way to make the nsurlconnection active even on the locked screen. Please suggest me some ideas.
Thanks in advance.