I am using the NSURLSession
to perform the upload of a file using the chunk transfer.
self.dataTask = [self uploadTaskWithRequest:urlRequest fromData:urlRequest.HTTPBody progress:nil completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {
if (error) {
//Error response
} else {
//Success response
}
}];
[self.dataTask resume];
The issue is that when the app goes to the background
it will not perform the continuous upload, the ongoing upload will suspend and resumes when app goes to foreground
.
I want to achieve the background transfer continuously for the chunk upload.
Any suggestion to achieve this?
Update:
Implemented the backgroundSessionConfiguration
and getting the below error.
Terminating app due to uncaught exception 'NSGenericException', reason: 'Upload tasks from NSData are not supported in background sessions.