Kodeco Forums

Cookbook: Using NSURLSession

Learn how to download and post data with NSURLSession quickly with some handy code snippets and examples.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/2392-cookbook-using-nsurlsession

Looking for some feedback; not sure you could help

Using NSURLSession, the callback kind of wait for the remote server to timeout to effectively fire (calling a vimeo feed, parsing it and then displaying uiviews on the scene)

I mostly don’t get how it works. I’d like my view to be populated from within the callback as soon as the response is returned

I ended up setting it in the main thread with the following NSURLSession.sessionWithConfiguration( NSURLSessionConfiguration.defaultSessionConfiguration, delegate:nil, delegateQueue: NSOperationQueue.mainQueue, rubymotion code but that’s almost the same) but I’m sure there’s a way to keep it in the background and still have right away when the response arrives

Thanks for your help on this one

I need some help with the NSURLSession, I’ve used dataTaskWithRequest method to write the data into the server, but I’m getting the NSHTTPResponse status code as 401 and unable to write the data to DB.
Pleas help me.

This tutorial is more than six months old so questions are no longer supported at the moment for it. We will update it as soon as possible. Thank you! :]