Is there any difference between dataWithContentsOfURL (threaded) and dataTaskWithURL?

后端 未结 2 1640
天涯浪人
天涯浪人 2021-01-24 15:25

We\'re using dataWithContentsOfURL because it is, uh, simple...

NSData *datRaw = [NSData dataWithContentsOfURL:ur];

Now, of course, that will h

2条回答
  •  温柔的废话
    2021-01-24 15:54

    One reason to prefer true async io over threaded synchronous io is that threads are not free memory-wise. It's not a huge deal in general but you can save a little memory in your app and (more importantly) a little wired memory in the OS's kernel by not keeping a thread sitting around doing nothing while it waits.

提交回复
热议问题