« MBS Xojo Plugins, ver… | Home | Half way through Apri… »

Adding NSURLSession classes for Xojo


For the current prerelease version 20.2pr3 we added NSURLSessionMBS and related classes to the MBS Xojo Plugins. Main reason is that we urgently needed a solution for a client to support HTTP/2 connections for a project. Long term plan is to add HTTP/2 to our CURL plugin someday, but for now it is easier to just leverage Apple's excellent NSURL Frameworks which do the heavy work for almost all network traffic in MacOS & iOS. The classes allow you to use the latest encryption settings automatically.

When using the classes, please first create an object of NSURLSessionConfigurationMBS class. Configure it to the options you need, e.g. what caching or cookie policies you like or whether to allow cellular or expensive connections.

Next you can initialize a new NSURLSessionMBS, usually via constructor and your own subclass to fill in the events. Alternatively for simple transfers you can use the sharedSession and use the default settings.

Then you use one of the NSURLSessionTaskMBS subclasses:Please try the new classes soon and let us know if you have any problems using them.

We formally deprecate NSURLConnectionMBS class, which is the older set of classes Apple provides for HTTP connections. You should move to NSURLSessionMBS soon. We won't remove them until Apple removes them, but you never know whether they will be part of next OS version. The biggest plugin in space...
15 04 20 - 10:34