# NSURLConnection class documentation

Software documentation for the NSURLConnection class
Foundation/NSURLConnection.h
Description forthcoming.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
canHandleRequest:
request
Performs a preliminary check to see if a load of the specified request can be handled by an instance of this class.
The results of this method may be invalidated by subsequent changes to the request or changes to the registered protocols etc.
connectionWithRequest:
request
delegate:
delegate
Allocates and returns the autoreleased instance which it initialises using the -initWithRequest:delegate: method.
cancel
Cancel the asynchronous load in progress (if any) for this connection.
initWithRequest:
request
delegate:
delegate
Initialises the receiver with the specified request (performing a deep copy so that the request does not change during loading) and delegate.
This automatically initiates an asynchronous load for the request.
Processing of the request is done in the thread which calls this method, so the thread must run its current run loop (in NSDefaultRunLoopMode) for processing to continue/complete.
The delegate will receive callbacks informing it of the progress of the load.
This method breaks with convention and retains the delegate object, releasing it when the connection finished loading, fails, or is cancelled.
initWithRequest:
request
delegate:
delegate
startImmediately:
startImmediately
Initialises the receiver with the specified request (performing a deep copy so that the request does not change during loading) and delegate.
This automatically initiates an asynchronous load for the request if and only if startImmediately is set to `YES`.
Processing of the request is done in the thread which calls this method, so the thread must run its current run loop (in NSDefaultRunLoopMode) for processing to continue/complete.
The delegate will receive callbacks informing it of the progress of the load.
This method breaks with convention and retains the delegate object, releasing it when the connection finished loading, fails, or is cancelled.
scheduleInRunLoop:
aRunLoop
forMode:
mode
Description forthcoming.
start
Start the asynchronous load. This method is only needed if `NO` is passed into startImmediately when calling initWithRequest: delegate: startImmediately.
unscheduleFromRunLoop:
aRunLoop
forMode:
mode
Description forthcoming.
Software documentation for the NSObject(NSURLConnectionDelegate) category
Foundation/NSURLConnection.h
Description forthcoming.
connection:
connection
didFailWithError:
error
Description forthcoming.
connection:
connection
didReceiveAuthenticationChallenge:
challenge
Called when an authentication challenge is received... the delegate should send -useCredential:forAuthenticationChallenge: or -continueWithoutCredentialForAuthenticationChallenge: or -cancelAuthenticationChallenge: to the challenge sender when done.
connection:
connection
didReceiveData:
data
Called when content data arrives during a load operations... this may be incremental or may be the compolete data for the load.
connection:
connection
didReceiveResponse:
response
Called when enough information to build a NSURLResponse object has been received.
connection:
connection
willCacheResponse:
cachedResponse
Called with the cachedResponse to be stored in the cache. The delegate can inspect the cachedResponse and return a modified copy if if wants changed to what whill be stored.
If it returns `nil`, nothing will be stored in the cache.
connection:
connection
willSendRequest:
request
redirectResponse:
response
Informs the delegate that the connection must change the URL of the request in order to continue with the load operation.
This allows the delegate to ionspect and/or modify a copy of the request before the connection continues loading it. Normally the delegate can return the request unmodifield.
The redirection can be rejectected by the delegate calling -cancel or returning `nil`.
Cancelling the load will simply stop it, but returning `nil` will cause it to complete with a redirection failure.
As a special case, this method may be called with a `nil` response, indicating a change of URL made internally by the system rather than due to a response from the server.
connectionDidFinishLoading:
connection
Called when an NSURLConnection has finished loading successfully.
Software documentation for the NSURLConnection(NSURLConnectionSynchronousLoading) category
Foundation/NSURLConnection.h
An interface to perform synchronous loading of URL requests.
sendSynchronousRequest:
request
returningResponse:
response
error:
error
Performs a synchronous load of request and returns the NSURLResponse in response.
Returns the result of the load or `nil` if the load failed.
Software documentation for the NSURLConnectionDataDelegate protocol
Foundation/NSURLConnection.h
NSURLConnectionDelegate
Description forthcoming.
connection:
connection
didReceiveData:
data
Description forthcoming.
connection:
connection
didReceiveResponse:
response
Description forthcoming.
connection:
connection
didSendBodyData:
bytesWritten
totalBytesWritten:
totalBytesWritten
totalBytesExpectedToWrite:
totalBytesExpectedToWrite
Description forthcoming.
connection:
connection
needNewBodyStream:
request
Description forthcoming.
connection:
connection
willCacheResponse:
cachedResponse
Description forthcoming.
connection:
connection
willSendRequest:
request
redirectResponse:
response
Description forthcoming.
connectionDidFinishLoading:
connection
Description forthcoming.
Software documentation for the NSURLConnectionDelegate protocol
Foundation/NSURLConnection.h
NSObject
Description forthcoming.