Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

NSURLConnectionMBS class

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class Cocoa Networking MBS MacBase Plugin 11.3 Yes No No Yes, macOS only No
Function: An NSURLConnection object provides support to perform the loading of a URL request.
The interface for NSURLConnection is sparse, providing only the controls to start and cancel asynchronous loads of a URL request.

NSURLConnection's events allow an object to receive informational callbacks about the asynchronous load of a URL request. Other events provide facilities that allow the subclass to customize the process of performing an asynchronous URL load. These events are called on the thread that started the asynchronous load operation for the associated NSURLConnection object.

NSURLConnection also has a convenience class method, sendSynchronousRequest, to load a URL request synchronously.

The following contract governs the events defined in this class:

  • Zero or more willSendRequest events are called before any further event is called if it is determined that the download must redirect to a new location. The delegate can allow the redirect, modify the destination, or deny the redirect.
  • Zero or more willSendRequestForAuthenticationChallenge events are called before a request for an authentication challenge is sent. The delegate can call the appropriate NSURLAuthenticationChallengeMBS method and perform any other required task related to credentials.
  • Zero or more didReceiveAuthenticationChallenge vents are called if it is necessary to authenticate in order to download the request and the connection does not already have authenticated credentials.
  • Zero or more didCancelAuthenticationChallenge vents are called if the connection cancels the authentication challenge due to the protocol implementation encountering an error.
  • Zero or more didReceiveResponse events are called before receiving a didReceiveData message. The only case where didReceiveResponse is not sent to a delegate is when the protocol implementation encounters an error before a response can be created.
  • Zero or more didReceiveData events are called before any of the following messages are sent to the delegate: willCacheResponse, DidFinishLoading, didFailWithError.
  • Zero or one willCacheResponse events are called to the delegate after didReceiveData is sent but before a DidFinishLoading message is sent.
Unless an NSURLConnection object receives a cancel message, the subclasses receives one and only one of DidFinishLoading, or didFailWithError message, but never both. In addition, once either of these messages is sent, the delegate receives no further messages for the connection.

Feedback, Comments & Corrections

This class has no sub classes.

Some examples which use this class:

The items on this page are in the following plugins: MBS MacBase Plugin.

NSURLCacheMBS   -   NSURLCredentialMBS

MBS Xojo Plugins