URLSession data vs download vs upload tasks
WHAT IT TESTS: choosing the right URLSession task. OUTLINE: data tasks buffer responses in memory for small API calls; download tasks stream to a file and support background transfers for large files; upload tasks send bodies from data or files and report…
WHAT IT TESTS: whether you match the task type to the transfer's size and lifecycle. ANSWER OUTLINE: a data task delivers the response into memory, ideal for small JSON REST calls; a download task writes the response to a temporary file rather than RAM and, with a background session, can continue when the app is suspended, ideal for large media; an upload task sends a request body from a Data object or file, suited to file uploads with progress and background support.
Read the original → interview
- #ios
- #urlsession
- #networking
- #background
- #tasks
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.