Created
June 18, 2019 19:10
-
-
Save fortmarek/8a06f6729dae636435d35ab419e0ee4b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private var urlSession: URLSession? | |
private func upload() { | |
if urlSession == nil { | |
let config = URLSessionConfiguration.background(withIdentifier: (Bundle.main.bundleIdentifier ?? "") + UUID().uuidString) | |
urlSession = URLSession(configuration: config, delegate: self, delegateQueue: nil) | |
} | |
} | |
extension ViewController: URLSessionDelegate, URLSessionTaskDelegate, URLSessionDataDelegate { | |
func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) {} | |
func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {} | |
func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment