NSURLConnection with delegate and initWithContentsOfURL: with Grand Central Dispatch

I am writing an application that downloads a lot of JSON data from the Internet. My application should parse the JSON data and then return the received objects to a makeshift delegate.

Now I was wondering if I could better use NSURLConnection or a combination of Grand Central Dispatch dispatch_asyncwith initWithContentsOfURL:(using GCD to prevent freezing).

Using Grand Central Dispatch is easier , especially because I do not need delegates, NSMutableData and all other variables that are used temporarily. But, of course, everyone who has a pro has its drawbacks.

What are the benefits of NSURLConnection over initWithContentsOfURLwith GCD?

+3
source share
1 answer
  • You can customize iOS 3.x.
  • You can use a customized NSURLRequest, which, for example, requests HTTP results from the POST-NSData factory, only performs a basic GET when passing an HTTP URL.
  • You can track the progress of the download with the NSURLConnection delegate.

What is it from my head. :)

+4
source

Source: https://habr.com/ru/post/1783408/


All Articles