November 2018
Intermediate to advanced
404 pages
10h 16m
English
To start uploading, use a shared URLSession instance to create an uploading URLSessionTask instance with the passing in URLRquest and the JSON data you have:
// Start an URLSession TaskURLSession.shared.uploadTask(with: request, from: jsonData) { (data, response, error) in if let error = error { print("Error", error) return }}.resume()
Since all tasks start in a suspended state, .resume() will be called to start the task after the .uploadTask(with: from:) method is called. Upon the completion of task upload, the results are received in a completion handler that checks for any transport or server errors and returns the requested data.
Read now
Unlock full access