What is difference between NSURLSessionDataTask vs NSURLSessionDownloadTask

后端 未结 5 519
执念已碎
执念已碎 2020-12-29 21:03

In latest apple introduce new NSURLSession in replace of NSURLConnection, so in there are different task , so what is the difference between

5条回答
  •  渐次进展
    2020-12-29 21:35

    Adding to the previous answers: Apple made it clear in their guide "URL Loading System"

    For small interactions with remote servers, you can use the URLSessionDataTask class to receive response data into memory (as opposed to using the URLSessionDownloadTask class, which stores the data directly to the file system). A data task is ideal for uses like calling a web service endpoint.

    https://developer.apple.com/documentation/foundation/url_loading_system/fetching_website_data_into_memory#overview

提交回复
热议问题