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.
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
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.
Incase any newbies get hung up: need to remove fileprivate for trackIndex method on APIManager in order to be accessed from SearchViewController extension.