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.
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.
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.
Start the asynchronous load. This method is only
needed if NO is passed into
startImmediately when calling
initWithRequest: delegate:
startImmediately.
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.
This category is an informal protocol specifying how an
NSURLConnection instance will communicate
with its delegate to inform it of (and allow it to
manage) the progress of a load request. A load
operation is performed by asynchronous I/O using
the run loop of the thread in which it was initiated, so
all callbacks will occur in that thread. The
process of loading a resource occurs as follows -
Any number of
-connection:willSendRequest:redirectResponse:
messages may be sent to the delegate before any other messages in this list are sent. This permits a chain of redirects to be followed before eventual loading of 'real' data.
Any number of
-connection:didReceiveResponse:
messages may be be sent to the delegate before a
-connection:didReceiveData:
message. Usually there is exactly one of these,
but for multipart/x-mixed-replace there may be
multiple responses for each part, and if an
error occurs in the download the delegate may not
receive a response at all. Delegates
should discard previously handled data when they
receive a new response.
Unless the NSURLConnection receives a
-cancel
message, the delegate will receive one and only
one of
-connectionDidFinishLoading:
, or
-connection:didFailWithError:
message, but never both. Once either of
these terminal messages is sent the delegate will
receive no further messages from the
NSURLConnection.
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.
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 nilresponse, indicating a change of URL made
internally by the system rather than due to a
response from the server.