# Networking with URLSession - Part 7: Background | Ray Wenderlich

**URL:** <https://forums.kodeco.com/t/networking-with-urlsession-part-7-background-ray-wenderlich/27391>\
**Category:** 🎓 Courses & Articles\
**Created:** [March 21, 2017, 3:04pm UTC](https://forums.kodeco.com/t/networking-with-urlsession-part-7-background-ray-wenderlich/27391 "2017-03-21T15:04:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![audrey](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/audrey/32/111607_2.png) [@audrey](https://forums.kodeco.com/u/audrey)\
**Post date:** [March 21, 2017, 3:04pm UTC](https://forums.kodeco.com/t/networking-with-urlsession-part-7-background-ray-wenderlich/27391/1 "2017-03-21T15:04:51Z")

</div>

Download and upload tasks can run in a background session. Find out how the system handles this, and learn some advice and tips for long-running tasks.

* * *
 This is a companion discussion topic for the original entry at [https://www.raywenderlich.com/3986-networking-with-urlsession/lessons/7](https://www.raywenderlich.com/3986-networking-with-urlsession/lessons/7)

---

<div class="post-metadata">

**Author:** ![ys\_xs](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/ys_xs/32/105896_2.png) [@ys\_xs](https://forums.kodeco.com/u/ys_xs)\
**Post date:** [April 23, 2017, 2:12pm UTC](https://forums.kodeco.com/t/networking-with-urlsession-part-7-background-ray-wenderlich/27391/2 "2017-04-23T14:12:04Z")

</div>

I think maybe there is a error in the finished challenge playground. In the method **URLSession:dataTask:didReceiveData:** , the data should append.  
so my english not very good, i just think so

---

<div class="post-metadata">

**Author:** ![audrey](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/audrey/32/111607_2.png) [@audrey](https://forums.kodeco.com/u/audrey)\
**Post date:** [April 23, 2017, 11:30pm UTC](https://forums.kodeco.com/t/networking-with-urlsession-part-7-background-ray-wenderlich/27391/3 "2017-04-23T23:30:37Z")

</div>

hi, thanks for your question! it helps to show the difference between the delegates for data task and download task.

A data task usually downloads a small amount of data, which is stored in memory, so `didReceiveData` receives all of it, then just saves it somewhere in the app.

A download task’s data can be very large, so it’s stored in a file while it downloads. The system calls the delegate method `didWriteData` in HalfTunes whenever it appends more data to this file.

---

<div class="post-metadata">

**Author:** ![montalto](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/montalto/32/69184_2.png) [@montalto](https://forums.kodeco.com/u/montalto)\
**Post date:** [May 26, 2017, 4:35am UTC](https://forums.kodeco.com/t/networking-with-urlsession-part-7-background-ray-wenderlich/27391/4 "2017-05-26T04:35:46Z")

</div>

Incase any newbies get hung up: need to remove `fileprivate` for `trackIndex` method on APIManager in order to be accessed from `SearchViewController` extension.
