Types of URLSession tasks in iOS

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.

  1. Data tasks: Data tasks send and receive data using NSData objects. They are intended for short and often interactive requests to server.
  2. Upload tasks: Upload tasks are similar to data tasks in addition they send data and enable upload when the app isn’t running.
  3. Download tasks: Download tasks are similar to data tasks in addition they retrieve data and enable download when the app isn’t running.
Advertisements

Leave a Reply