< Previous PageNext Page > Hide TOC

Deprecated NSURLHandle Methods

A method identified as deprecated has been superseded and may become unsupported in the future.

Deprecated in Mac OS X v10.4 and later

cachedHandleForURL:

Returns the URL handle from the cache that has serviced the specified URL or another identical URL. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

+ (NSURLHandle *)cachedHandleForURL:(NSURL *)aURL

Parameters
aURL

The URL whose cached URL handle is desired.

Return Value

The URL handle from the cache that has serviced aURL or another identical URL. Returns nil if there is no such handle.

Discussion

Subclasses of NSURLHandle must override this method.

Availability
Declared In
NSURLHandle.h

canInitWithURL:

Returns whether a URL handle can be initialized with a given URL. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

+ (BOOL)canInitWithURL:(NSURL *)aURL

Parameters
aURL

The URL in question.

Return Value

YES if a URL handle can be initialized with aURL, NO otherwise.

Discussion

Subclasses of NSURLHandle must override this method to identify which URLs they can service.

Availability
Declared In
NSURLHandle.h

registerURLHandleClass:

Registers a subclass of NSURLHandle as an available subclass for handling URLs (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

+ (void)registerURLHandleClass:(Class)aURLHandleSubclass

Parameters
aURLHandleSubclass

The new subclass to register as an available subclass.

Availability
Declared In
NSURLHandle.h

URLHandleClassForURL:

Returns the class of the URL handle that will be used for a specified URL. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

+ (Class)URLHandleClassForURL:(NSURL *)aURL

Parameters
aURL

The URL in question.

Return Value

The class of the URL handle that will be used for aURL.

Discussion

Subclasses of NSURLHandle must be registered via the registerURLHandleClass: method. The subclass is determined by asking the list of registered subclasses if it canInitWithURL:; the first class to respond YES is selected.

Availability
Declared In
NSURLHandle.h

addClient:

Adds a client of the URL handle. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

- (void)addClient:(id < NSURLHandleClient >)client

Parameters
client

An object conforming to the NSURLHandleClient protocol.

Availability
Declared In
NSURLHandle.h

availableResourceData

Immediately returns the currently available resource data managed by the URL handle. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

- (NSData *)availableResourceData

Return Value

The currently available resource data managed by the URL handle. Returns nil if a previous attempt to load the data failed.

Availability
Declared In
NSURLHandle.h

backgroundLoadDidFailWithReason:

Called when a background load fails. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

- (void)backgroundLoadDidFailWithReason:(NSString *)reason

Parameters
reason

The status message indicating why the background load failed.

Discussion

This method is provided mainly for subclasses that wish to take some action before passing along the failure notification to the URL client. This method should invoke super’s implementation before returning.

Availability
Declared In
NSURLHandle.h

beginLoadInBackground

Called when a background load begins. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

- (void)beginLoadInBackground

Discussion

This method is provided mainly for subclasses that wish to take advantage of the superclass failure-reporting mechanism.

Availability
See Also
Declared In
NSURLHandle.h

cancelLoadInBackground

Called to cancel a load currently in progress. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

- (void)cancelLoadInBackground

Discussion

This method is provided mainly for subclasses that wish to take some action before a background load is canceled. This method should invoke super’s implementation before returning.

Availability
See Also
Declared In
NSURLHandle.h

didLoadBytes:loadComplete:

Appends new data to the receiver’s resource data. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

- (void)didLoadBytes:(NSData *)newBytes loadComplete:(BOOL)done

Parameters
newBytes

The newly loaded bytes.

done

YES if newBytes contains the last piece of data for the URL, NO otherwise.

Discussion

You should call this method when loading the resource data in the background.

Availability
See Also
Declared In
NSURLHandle.h

endLoadInBackground

Halts any background loading. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

- (void)endLoadInBackground

Discussion

This method is called by cancelLoadInBackground.

Availability
See Also
Declared In
NSURLHandle.h

expectedResourceDataSize

Returns the expected length of the resource data if it is provided by the server. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

- (long long)expectedResourceDataSize

Return Value

The expected size of the resource data, in bytes. A negative value if the length is unknown.

Discussion

This information can be queried before all the data has arrived.

Availability
Declared In
NSURLHandle.h

failureReason

Returns a string describing the reason a load failed. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

- (NSString *)failureReason

Return Value

A string describing the reason a load failed. If the load has not failed, returns nil.

Availability
Declared In
NSURLHandle.h

flushCachedData

Flushes any cached data for the URL served by this URL handle. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

- (void)flushCachedData

Availability
Declared In
NSURLHandle.h

initWithURL:cached:

Initializes a newly created URL handle with the specified URL. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

- (id)initWithURL:(NSURL *)aURL cached:(BOOL)willCache

Parameters
aURL

The URL for the new handle.

willCache

YES if the URL handle should cache its data and respond to requests from equivalent URLs for the cached data, NO otherwise.

Discussion

Subclasses of NSURLHandle must override this method.

Availability
Declared In
NSURLHandle.h

loadInBackground

Loads the receiver’s data in the background. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

- (void)loadInBackground

Discussion

Each subclass determines its own loading policy. Clients should not assume that multiple background loads can proceed simultaneously. For example, a subclass may maintain only one thread for background loading, so only one background loading operation can be in progress at a time. If multiple background loads are requested, the later requests will wait in a queue until earlier requests are handled.

Availability
See Also
Declared In
NSURLHandle.h

loadInForeground

Loads the receiver’s data synchronously. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

- (NSData *)loadInForeground

Return Value

The loaded data.

Discussion

Called by resourceData. Subclasses of NSURLHandle must override this method.

Availability
Declared In
NSURLHandle.h

propertyForKey:

Returns the property for the specified key. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

- (id)propertyForKey:(NSString *)propertyKey

Parameters
propertyKey

The key of the desired property.

Return Value

The value associated with propertyKey. Returns nil if there is no such key.

Discussion

Subclasses of NSURLHandle must override this method.

Availability
See Also
Declared In
NSURLHandle.h

propertyForKeyIfAvailable:

Returns the property for the specified key only if the value is already available; that is, the client doesn’t need to do any work. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

- (id)propertyForKeyIfAvailable:(NSString *)propertyKey

Parameters
propertyKey

The key of the desired property.

Return Value

The value associated with propertyKey. Returns nil if there is no such key or if the client would have to do work to fetch the property.

Availability
Declared In
NSURLHandle.h

removeClient:

Removes client as an NSURLHandleClient of the receiver. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

- (void)removeClient:(id < NSURLHandleClient >)client

Parameters
client

An object conforming to the NSURLHandleClient protocol.

Availability
Declared In
NSURLHandle.h

resourceData

Returns the resource data managed by the receiver, loading it if necessary. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

- (NSData *)resourceData

Return Value

The resource data managed by the receiver.

Discussion

Blocks until all data is available.

Availability
Declared In
NSURLHandle.h

status

Returns the status of the receiver. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

- (NSURLHandleStatus)status

Return Value

The status of the receiver. Possible return statuses are described in “Constants.”

Availability
Declared In
NSURLHandle.h

writeData:

Attempts to write a specified set of data to the location specified by the receiver’s URL. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

- (BOOL)writeData:(NSData *)data

Parameters
data

The data to write.

Return Value

YES if successful, NO otherwise.

Discussion

Must be overridden by subclasses.

Availability
Declared In
NSURLHandle.h

writeProperty:forKey:

Sets the property of the receiver’s resource for a specified key to the specified value. (Deprecated in Mac OS X v10.4 and later. Use NSURLConnection or NSURLDownload instead; see URL Loading System.)

- (BOOL)writeProperty:(id)propertyValue forKey:(NSString *)propertyKey

Parameters
propertyValue

The new value for the property.

propertyKey

The key of the desired property.

Return Value

YES if the modification was successful, NO otherwise.

Discussion

Must be overridden by subclasses.

Availability
See Also
Declared In
NSURLHandle.h

< Previous PageNext Page > Hide TOC


© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-02-04)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.