Within a URLSession, we create tasks that currently upload data to server or retrieve data from server. The URLSession API provides three types of tasks.
- Data tasks: Data tasks send and receive data using NSData objects. They are intended for short and often interactive requests to server.
- Upload tasks: Upload tasks are similar to data tasks in addition they send data and enable upload when the app isn’t running.
- Download tasks: Download tasks are similar to data tasks in addition they retrieve data and enable download when the app isn’t running.