NSURLconnection deprecated, how to use NSURLsession?

Hello guys, I’ve bought your book on Objective-C a couple of weeks ago, and I’m struggling a bit at chapter 27. XCode tells me that NSURLconnection is deprecated. Everything still works though, but is there an example available to see how the same goals are achieved using NSURLsession? Especially with regards to the delegation to the object that we made. Thanks!

I’ve been struggling with this a lot as well. Would love a little extra guidance on understanding how to translate the NSConnection methodology to the NSSession language. I’m having a really hard time understanding the developer materials on this topic.

Hey y’all.

NSURLSession is indeed a bit of a different beast.

I put together a small demo that mimics the NSURLConnection portion of the exercise, but using NSURLSession instead. You can find it here:
mw-dropshare.s3.amazonaws.com/S … tM155p.zip

I hope it helps. Please feel free to ask questions about it.

Also, don’t let the NSURLConnection/Session stuff distract you from the main lesson of this portion of this chapter, which is about the Delegation design pattern. Any iOS book worth its weight (ours included) will show you a modern example of accessing web services using NSURLSession, so those details can wait. For now, the thing to focus on is delegation itself.