Up

# NSURLConnection class documentation

### Authors

Generated by Debian

### Contents -

1. Software documentation for the NSURLConnection class
2. Software documentation for the NSObject(NSURLConnectionDelegate) category
3. Software documentation for the NSURLConnection(NSURLConnectionSynchronousLoading) category
4. Software documentation for the NSURLConnectionDelegate protocol

# Software documentation for the NSURLConnection class

## NSURLConnection : NSObject

> Declared in:
>   Foundation/NSURLConnection.h

Availability: MacOS-X 10.2.0, Base 1.13.0
Description forthcoming.

Instance Variables
Method summary

- +sendSynchronousRequest:returningResponse:error:
- +canHandleRequest:
- +connectionWithRequest:delegate:
- -cancel
- -initWithRequest:delegate:
- -initWithRequest:delegate:startImmediately:
- -scheduleInRunLoop:forMode:
- -start
- -unscheduleFromRunLoop:forMode:

### canHandleRequest:

+ (BOOL) canHandleRequest: (NSURLRequest*)request;
Availability: MacOS-X 10.2.0, Base 1.13.0
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: delegate:

+ (NSURLConnection*) connectionWithRequest: (NSURLRequest*)request delegate: (id)delegate;
Availability: MacOS-X 10.2.0, Base 1.13.0
Allocates and returns the autoreleased instance which it initialises using the -initWithRequest:delegate: method.

### cancel

- (void) cancel;
Availability: MacOS-X 10.2.0, Base 1.13.0
Cancel the asynchronous load in progress (if any) for this connection.

### initWithRequest: delegate:

- (id) initWithRequest: (NSURLRequest*)request delegate: (id)delegate;
Availability: MacOS-X 10.2.0, Base 1.13.0
This is a designated initialiser for the class.
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: delegate: startImmediately:

- (id) initWithRequest: (NSURLRequest*)request delegate: (id)delegate startImmediately: (BOOL)startImmediately;
Availability: MacOS-X 10.5.0, Base 1.13.0
This is a designated initialiser for the class.
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: forMode:

- (void) scheduleInRunLoop: (NSRunLoop*)aRunLoop forMode: (NSRunLoopMode)mode;
Availability: MacOS-X 10.5.0, Base 1.13.0
Description forthcoming.

### start

- (void) start;
Availability: MacOS-X 10.5.0, Base 1.13.0
Start the asynchronous load. This method is only needed if `NO` is passed into startImmediately when calling initWithRequest: delegate: startImmediately.

### unscheduleFromRunLoop: forMode:

- (void) unscheduleFromRunLoop: (NSRunLoop*)aRunLoop forMode: (NSRunLoopMode)mode;
Availability: MacOS-X 10.5.0, Base 1.13.0
Description forthcoming.

## Instance Variables for NSURLConnection Class

### _NSURLConnectionInternal

@protected void* _NSURLConnectionInternal;
Availability: MacOS-X 10.2.0, Base 1.13.0
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.

# Software documentation for the NSObject(NSURLConnectionDelegate) category

## NSObject(NSURLConnectionDelegate)

> Declared in:
>   Foundation/NSURLConnection.h

Availability: MacOS-X 10.7.0, Base 1.13.0
Description forthcoming.
Method summary

- -connection:didFailWithError:
- -connection:didReceiveAuthenticationChallenge:
- -connection:didReceiveData:
- -connection:didReceiveResponse:
- -connection:willCacheResponse:
- -connection:willSendRequest:redirectResponse:
- -connectionDidFinishLoading:

### connection: didFailWithError:

- (void) connection: (NSURLConnection*)connection didFailWithError: (NSError*)error;
Availability: MacOS-X 10.2.0, Base 1.13.0
Description forthcoming.

### connection: didReceiveAuthenticationChallenge:

- (void) connection: (NSURLConnection*)connection didReceiveAuthenticationChallenge: (NSURLAuthenticationChallenge*)challenge;
Availability: MacOS-X 10.2.0, Base 1.13.0
Called when an authentication challenge is received... the delegate should send -useCredential:forAuthenticationChallenge: or -continueWithoutCredentialForAuthenticationChallenge: or -cancelAuthenticationChallenge: to the challenge sender when done.

### connection: didReceiveData:

- (void) connection: (NSURLConnection*)connection didReceiveData: (NSData*)data;
Availability: MacOS-X 10.2.0, Base 1.13.0
Called when content data arrives during a load operations... this may be incremental or may be the compolete data for the load.

### connection: didReceiveResponse:

- (void) connection: (NSURLConnection*)connection didReceiveResponse: (NSURLResponse*)response;
Availability: MacOS-X 10.2.0, Base 1.13.0
Called when enough information to build a NSURLResponse object has been received.

### connection: willCacheResponse:

- (NSCachedURLResponse*) connection: (NSURLConnection*)connection willCacheResponse: (NSCachedURLResponse*)cachedResponse;
Availability: MacOS-X 10.2.0, Base 1.13.0
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: willSendRequest: redirectResponse:

- (NSURLRequest*) connection: (NSURLConnection*)connection willSendRequest: (NSURLRequest*)request redirectResponse: (NSURLResponse*)response;
Availability: MacOS-X 10.2.0, Base 1.13.0
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:

- (void) connectionDidFinishLoading: (NSURLConnection*)connection;
Availability: MacOS-X 10.2.0, Base 1.13.0
Called when an NSURLConnection has finished loading successfully.

# Software documentation for the NSURLConnection(NSURLConnectionSynchronousLoading) category

## NSURLConnection(NSURLConnectionSynchronousLoading)

> Declared in:
>   Foundation/NSURLConnection.h

Availability: MacOS-X 10.2.0, Base 1.13.0
An interface to perform synchronous loading of URL requests.
Method summary

- +sendSynchronousRequest:returningResponse:error:

### sendSynchronousRequest: returningResponse: error:

+ (NSData*) sendSynchronousRequest: (NSURLRequest*)request returningResponse: (NSURLResponse**)response error: (NSError**)error;
Availability: MacOS-X 10.2.0, Base 1.13.0
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 NSURLConnectionDelegate protocol

## NSURLConnectionDelegate

> Declared in:
>   Foundation/NSURLConnection.h

> Conforms to:
>   NSObject

Availability: MacOS-X 10.7.0, Base 1.13.0
Description forthcoming.
Up