Can NSURLSession do something NSURLConnection can't?
NSURLSession can do many things that NSURLConnection can’t. The most important is that it allows you to group specific requests (instances of NSURLConnection in the old API, instances of NSURLSessionTask in the new) into sessions, which then lets you set parameters on those sessions as a group. This is important because it allows library code to do work within your process without interfering with your app’s code, or other library code running within your process. NSURLConnection relies entirely on a bunch of singletons—some visible to you, like the NSURLCache, some not visible to you, like the TLS session cache—and that makes it very hard to write library code safely.
The reason why NSURLConnection was deprecated is that we don’t want to maintain two very similar APIs forever. But, as junkpile said, there’s a lot of code that uses NSURLConnection, so the implementation is not going to be removed any time soon. OTOH, we’re already seeing new platforms, like watchOS, that have NSURLSession but not NSURLConnection.
Share and Enjoy
—
Quinn "The Eskimo!"
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"