Existe alguma diferença entre dataWithContentsOfURL (threaded) e dataTaskWithURL?

Estamos usando dataWithContentsOfURL porque é, uh, simples ...

NSData *datRaw = [NSData dataWithContentsOfURL:ur];

Agora, é claro, isso travará o thread principal da interface do usuário.

Então, colocamos em outro segmento. Fazemos isso exatamente assim,

-(void)performSearch:(NSString *)stuff then:(void(^)(void))after
 {
  dispatch_queue_t otherThread =dispatch_queue_create(nil,0);
  dispatch_queue_t mainThread =dispatch_get_main_queue();
  dispatch_async(otherThread,
    ^{
    self.resultsRA = [self ... calls dataWithContentsOfURL ...];

    dispatch_async(mainThread, ^{  if (after) after(); });
    });
 }

(Aliás, aqui está uma excelente introdução a isso, se necessáriohttps://stackoverflow.com/a/7291056/294884)

Bem, agora, a Apple diz que vocênão deve usar dataWithContentsOfURL, eles dizemvocê deveria basta usar o NSSession. Assim,dataTaskWithURL:completionHandler:

Minha pergunta, existe alguma diferença entre criar nosso próprio thread (ou seja, com dataWithContentsOfURL) e usar o dataTask?

Erramos ao usar dataWithContentsOfURL: em um thread, por algum motivo? Eu aprecio que seja mais conveniente, etc. Quero dizer, existem diferenças reais, quaisquer perigos, etc.

questionAnswers(2)

yourAnswerToTheQuestion