args.resume
不再有.resume()-根据需要使用模拟数据-或根据需要实时数据 (No more .resume() — Use Mock Data as you please — Or Live data if you need)
If you work with networking in Swift, chances are you’ve used URLSession. Chances are also that you’ve spent 1, 2 or a hundred minutes debugging a call that just wouldn’t fire! Then you sheepishly realized you forgot .resume() at the end of your dataTask…
如果您在Swift中使用网络,则很有可能使用过URLSession。 也有可能您花了1、2或一百分钟来调试不会触发的呼叫! 然后,您令人毛骨悚然地意识到,在dataTask的末尾忘记了.resume()…
为什么我甚至需要.resume()? (Why do I even need .resume() ?)
If you look carefully at the way we do a network call, we aren’t immediately doing anything with the code inside of our dataTask. The dataTask method returns a URLSessionDataTask object that you can use for Asynchronous operations.
如果仔细看一下我们进行网络调用的方式,我们不会立即对dataTask内部的代码执行任何操作。 dataTask方法返回可用于异步操作的URLSessionDataTask对象。
Once you call one of the methods on dataTask, things begin to happen. Focusing on our “culprit” here, the resume method…
一旦调用dataTask的方法之一,事情就会开始发生。 在这里关注我们的“罪魁祸首”,简历方法……
URLSessionDataTask inherit