colemancda on rewrite
Removed legacy code (compare)
Hi i am trying to upload file in background
let config = URLSessionConfiguration.background(withIdentifier: NSUUID().uuidString)
let session = URLSession(configuration: config, delegate: self, delegateQueue: nil)
let task = session.uploadTask(withStreamedRequest: request)
task.resume();
After this i am trying to register a completion handler like
func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError: Error?){
print("here URLSessionTask")
print(session)
}
I have also written
func urlSessionDidFinishEvents(forBackgroundURLSession session: URLSession) {
print("forBackgroundURLSession")
print(session)
}
func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) {
print("here didBecomeInvalidWithError")
print(session)
}
But none of the methods are getting called files are getting uploded into server i can see files in server what am i doing wrong please help
Thanks
Hi i am trying to upload file in background
let config = URLSessionConfiguration.background(withIdentifier: NSUUID().uuidString)
let session = URLSession(configuration: config, delegate: self, delegateQueue: nil)
let task = session.uploadTask(withStreamedRequest: request)
task.resume();
After this i am trying to register a completion handler likefunc urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError: Error?){
print("here URLSessionTask")
print(session)
}
I have also written
`func urlSessionDidFinishEvents(forBackgroundURLSession session: URLSession) {
print("forBackgroundURLSession")
print(session)
}
func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) {
print("here didBecomeInvalidWithError")
print(session)
}`
But none of the methods are getting called files are getting uploded into server i can see files in server what am i doing wrong please help
Thanks