Xojo Conferences
MBSOct2019CologneDE

Platforms to show: All Mac Windows Linux Cross-Platform

NSURLConnectionMBS.canAuthenticateAgainstProtectionSpace(protectionSpace as NSURLProtectionSpaceMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
event Cocoa Networking MBS MacBase Plugin 11.3 Yes No No No No
Function: Sent to determine whether the delegate is able to respond to a protection space's form of authentication.
Notes:
protectionSpace: The protection space that generates an authentication challenge.

Return true if you are able to respond to a protection space's form of authentication, otherwise false.

This method is called before didReceiveAuthenticationChallenge, allowing the class to inspect a protection space before attempting to authenticate against it. By returning true, the event indicates that it can handle the form of authentication, which it does in the subsequent call to didReceiveAuthenticationChallenge. If the event returns false, the system attempts to use the user's keychain to authenticate. If your delegate does not implement this method and the protection space uses client certificate authentication or server trust authentication, the system behaves as if you returned false. The system behaves as if you returned true for all other authentication methods.

Available in Mac OS X v10.6 and later.

Feedback, Comments & Corrections

NSURLConnectionMBS.didCancelAuthenticationChallenge(challenge as NSURLAuthenticationChallengeMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
event Cocoa Networking MBS MacBase Plugin 11.3 Yes No No No No
Function: Sent when a connection cancels an authentication challenge.
Notes: challenge: The challenge that was canceled.

Feedback, Comments & Corrections

NSURLConnectionMBS.didFailWithError(error as NSErrorMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
event Cocoa Networking MBS MacBase Plugin 11.3 Yes No No No No
Function: Sent when a connection fails to load its request successfully.
Notes:
error: An error object containing details of why the connection failed to load the request successfully.

Once the delegate receives this message, it will receive no further messages for connection.

Feedback, Comments & Corrections

NSURLConnectionMBS.didFinishLoading
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
event Cocoa Networking MBS MacBase Plugin 11.3 Yes No No No No
Function: Sent when a connection has finished loading successfully.

Feedback, Comments & Corrections

NSURLConnectionMBS.didReceiveAuthenticationChallenge(challenge as NSURLAuthenticationChallengeMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
event Cocoa Networking MBS MacBase Plugin 11.3 Yes No No No No
Function: Sent when a connection must authenticate a challenge in order to download its request.
Notes:
challenge: The challenge that connection must authenticate in order to download its request.

This method gives the class the opportunity to determine the course of action taken for the challenge provide credentials, continue without providing credentials, or cancel the authentication challenge and the download.

The delegate can determine the number of previous authentication challenges by sending the message previousFailureCount to challenge.

If the previous failure count is 0 and the value returned by proposedCredential is nil, the delegate can create a new NSURLCredential object, providing information specific to the type of credential, and send a useCredential:forAuthenticationChallenge: message to [challenge sender], passing the credential and challenge as parameters. If proposedCredential is not nil, the value is a credential from the URL or the shared credential storage that can be provided to the user as feedback.

The delegate may decide to abandon further attempts at authentication at any time by sending [challenge sender] a continueWithoutCredentialForAuthenticationChallenge: or a cancelAuthenticationChallenge: message. The specific action is implementation dependent.

If the delegate implements this method, the download will suspend until [challenge sender] is sent one of the following messages: useCredential:forAuthenticationChallenge:, continueWithoutCredentialForAuthenticationChallenge: or cancelAuthenticationChallenge:.

If the delegate does not implement this method the default implementation is used. If a valid credential for the request is provided as part of the URL, or is available from the NSURLCredentialStorage the [challenge sender] is sent a useCredential:forAuthenticationChallenge: with the credential. If the challenge has no credential or the credentials fail to authorize access, then continueWithoutCredentialForAuthenticationChallenge: is sent to [challenge sender] instead.

Feedback, Comments & Corrections

NSURLConnectionMBS.didReceiveData(newData as Memoryblock)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
event Cocoa Networking MBS MacBase Plugin 11.3 Yes No No No No
Function: Sent as a connection loads data incrementally.
Notes:
newdata: The newly available data.

The data property is updated before this event is called and gives you a way to see all data received so far.

Feedback, Comments & Corrections

NSURLConnectionMBS.didReceiveResponse(response as NSURLResponseMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
event Cocoa Networking MBS MacBase Plugin 11.3 Yes No No No No
Function: Sent when the connection has received sufficient data to construct the URL response for its request.
Notes:
response: The URL response for the connection's request. This object is immutable and will not be modified by the URL loading system once it is presented to the delegate.

In rare cases, for example in the case of an HTTP load where the content type of the load data is multipart/x-mixed-replace, the delegate will receive more than one didReceiveResponse message. In the event this occurs, delegates should discard all data previously delivered by didReceiveData, and should be prepared to handle the, potentially different, MIME type reported by the newly reported URL response.

The only case where this message is not sent to the delegate is when the protocol implementation encounters an error before a response could be created.

Feedback, Comments & Corrections

NSURLConnectionMBS.didSendBodyData(bytesWritten as Int64, totalBytesWritten as Int64, totalBytesExpectedToWrite as Int64)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
event Cocoa Networking MBS MacBase Plugin 11.3 Yes No No No No
Function: Sent as the body (message data) of a request is transmitted (such as in an http POST request).
Notes:
bytesWritten: The number of bytes written in the latest write.
totalBytesWritten: The total number of bytes written for this connection.
totalBytesExpectedToWrite: The number of bytes the connection expects to write.

This method provides an estimate of the progress of a URL upload.
The value of totalBytesExpectedToWrite may change during the upload if the request needs to be retransmitted due to a lost connection or an authentication challenge from the server.
Available in Mac OS X v10.6 and later.

Feedback, Comments & Corrections

NSURLConnectionMBS.shouldUseCredentialStorage as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
event Cocoa Networking MBS MacBase Plugin 11.3 Yes No No No No
Function: Sent to determine whether the URL loader should consult the credential storage for authenticating the connection.
Notes:
This method is called before any attempt to authenticate is made. By returning false, the delegate tells the connection not to consult the credential storage and makes itself responsible for providing credentials for any authentication challenges. Not implementing this method is the same as returning true. The delegate is free to consult the credential storage itself when it receives a didReceiveAuthenticationChallenge event.

Available in Mac OS X v10.6 and later.

Feedback, Comments & Corrections

NSURLConnectionMBS.willCacheResponse(cachedResponse as NSCachedURLResponseMBS) as NSCachedURLResponseMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
event Cocoa Networking MBS MacBase Plugin 19.0 Yes No No No No
Function: The connection will cache this response.
Notes: If you implement this event, please return request to cache or nil to not cache.

Feedback, Comments & Corrections

NSURLConnectionMBS.willSendRequest(request as NSURLRequestMBS, redirectResponse as NSURLResponseMBS) as NSURLRequestMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
event Cocoa Networking MBS MacBase Plugin 11.3 Yes No No No No
Function: Sent when the connection determines that it must change URLs in order to continue loading a request.
Notes:
request: The proposed redirected request. You should inspect the redirected request to verify that it meets its needs, and create a copy with new attributes to return to the connection if necessary.
redirectResponse: The URL response that caused the redirect. May be nil in cases where this method is not being sent as a result of involving the delegate in redirect processing.

The actual URL request to use in light of the redirection response. The event may return request unmodified to allow the redirect, return a new request, or return nil to reject the redirect and continue processing the connection.

If you wish to cancel the redirect connection, it should call the connection object's cancel method. Alternatively, the delegate method can return nil to cancel the redirect connection, and the original connection will continue to process. This has special relevance in the case where redirectResponse is not nil. In this case, any data that is loaded for the connection will be sent to the delegate, and the delegate will receive a connectionDidFinishLoading or didFailLoadingWithError message, as appropriate.

Note: Prior to Mac OS X version 10.5, returning nil in this method sometimes would cancel the connection but other times would cause the connection to use the given request unmodified. In addition, prior to version 10.5, NSURLConnection would often modify the incoming NSURLRequest object before transmission without notifying the delegate. In version 10.5 and later, it always notifies the delegate via willSendRequest, and thus the delegate might receive this message before the connection has even properly begun, prior to transmitting the request to the remote server.
The delegate can receive this message as a result of modifying a request before it is sent, for example to transform the request's URL to its canonical form. To detect this case, examine redirectResponse; if it is nil, the message was not sent due to a redirect.

The delegate should be prepared to receive this message multiple times.

Feedback, Comments & Corrections

NSURLConnectionMBS.willSendRequestForAuthenticationChallenge(challenge as NSURLAuthenticationChallengeMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
event Cocoa Networking MBS MacBase Plugin 11.3 Yes No No No No
Function: Tells the delegate that the connection will send a request for an authentication challenge.
Notes:
challenge: The authentication challenge for which a request is being sent.

This method allows the delegate to make an informed decision about connection authentication at once. If the delegate implements this method, it has no need to implement canAuthenticateAgainstProtectionSpace, didReceiveAuthenticationChallenge, shouldUseCredentialStorage. In fact, these other methods are not invoked.

In this method,you must invoke one of the challenge-responder methods (NSURLAuthenticationChallengeSenderMBS):

useCredential
continueWithoutCredentialForAuthenticationChallenge
cancelAuthenticationChallenge
performDefaultHandlingForAuthenticationChallenge
rejectProtectionSpaceAndContinueWithChallenge

You might also want to analyze challenge for the authentication scheme and the proposed credential before calling a NSURLAuthenticationChallengeSenderMBS method. You should never assume that a proposed credential is present. You can either create your own credential and respond with that, or you can send the proposed credential back. (Because this object is immutable, if you want to change it you must copy it and then modify the copy.)

Feedback, Comments & Corrections

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

The biggest plugin in space...




Links
MBS FileMaker Plugins