|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|
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.
- 11 events
- event canAuthenticateAgainstProtectionSpace(protectionSpace as NSURLProtectionSpaceMBS) as boolean
- event didCancelAuthenticationChallenge(challenge as NSURLAuthenticationChallengeMBS)
- event didFailWithError(error as NSErrorMBS)
- event didFinishLoading
- event didReceiveAuthenticationChallenge(challenge as NSURLAuthenticationChallengeMBS)
- event didReceiveData(newData as Memoryblock)
- event didReceiveResponse(response as NSURLResponseMBS)
- event didSendBodyData(bytesWritten as Int64, totalBytesWritten as Int64, totalBytesExpectedToWrite as Int64)
- event shouldUseCredentialStorage as boolean
- event willSendRequest(request as NSURLRequestMBS, redirectResponse as NSURLResponseMBS) as NSURLRequestMBS
- event willSendRequestForAuthenticationChallenge(challenge as NSURLAuthenticationChallengeMBS)
- property Handle as Integer
- 5 methods
- 2 shared methods
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.
MBS FileMaker Plugins