Kodeco Forums

Video Tutorial: Networking With NSURLSession Part 6: Conclusion

Review what you learned in our Networking with NSURLSession video tutorial series and find out where to go from here.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3759-networking-with-nsurlsession/lessons/7

Loved this series, Jerry! Thanks for putting this together.

Any chance of you doing a more in-depth series on some of the intricacies of using custom queues (i.e.: responding to changes in network quality/speed, etc.)? Would love to see that expanded.

Thanks again!
Frank

Thanks, Frank, glad it was helpful. I’ll keep the suggestion in mind.

1 Like

Excellent series Jerry.

1 Like

Thanks! Glad it was helpful.

A much needed and helpful course - thanks Jerry.

Nice job! Saw it twice! Would be interested in knowing if it’s possible to combine urlsession() with operations(). Seems like a perfect match to handle dependencies. I tried a simple example and it didn’t work. I always end up having to nest session tasks to handle dependencies.

Perhaps an option for the Swift 3 version!

Comments?

I had the same thought, but URLSessionTask inherits from NSObject, not Operation, so it doesn’t seem like this is supported directly. You could create an Operation subclass that runs a URLSessionTask and add dependencies that way.

Hi, I have a comment and another question.

Above I mentioned that I had tried a simple example using urlsession() with operations() and it didn’t work. I decided to go back and figure out why it didn’t work and quickly realized that I need to use async version of operations; meaning, implementation of all the extra stuff (i.e.: executing, ready, finished, KVO, etc.). Once I did this, I now have my urlsession() working nicely with operations that specify dependencies.

Now to my question: I need some help understanding if I need to use allowsCellularAccess. I have added a setting to my app to control allowing cellular access. I use that setting to assign a value to accessallowsCellularAccess.

But iOS offers global settings to allow access to cellular network for apps as shown here.

Now I am wondering if I really need my own setting. I would be fine with the iOS setting; so, perhaps I just need to remove my setting, ignore accessallowsCellularAccess and let the global iOS setting handle everything.

Is it necessary to provide an app specific setting to use for accessallowsCellularAccess? Or is it OK to just let the global setting control the access.

I only do periodic downloads of small amounts of data (~25K).

Thanks,

Ramon.

I would only use allowsCellularAccess if you had different NSURLSession queues in your app that have different priorities, not to provide a user-facing setting. You’re right, you should leave that up to the system. But, for example, if you had a session that proactively downloaded data that wouldn’t be used until the future, you might want to create that session with allowsCellularAccess set to false.