Mac Developer Library

Developer

Foundation Framework Reference NSURLHandle Class Reference

Options
Deployment Target:

On This Page
Language:

NSURLHandle

Inheritance


Conforms To


Import Statement


Swift

import Foundation

Objective-C

@import Foundation;

Availability


Available in OS X v10.0 and later.

NSURLHandle declares the programmatic interface for an object that accesses and manages resource data indicated by an NSURL object. A single NSURLHandle can service multiple equivalent NSURL objects, but only if these URLs map to the same resource.

Cocoa provides private concrete subclasses to handle HTTP and file URL schemes. If you want to implement support for additional URL schemes, you would do so by creating a subclass of NSURLHandle. You can use NSURL and NSURLHandle to download from FTP sites without subclassing.

  • Returns the URL handle from the cache that has serviced the specified URL or another identical URL.

    Deprecation Statement

    Use NSURLConnection or NSURLDownload instead; see URL Loading System Programming Guide.

    Declaration

    Objective-C

    + (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.

    Import Statement

    Objective-C

    @import Foundation;

    Availability

    Deprecated in OS X v10.4 and later.

  • Initializes a newly created URL handle with the specified URL.

    Deprecation Statement

    Use NSURLConnection or NSURLDownload instead; see URL Loading System Programming Guide.

    Declaration

    Objective-C

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

    Parameters

    aURL

    The URL for the new handle.

    willCache

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

    Discussion

    Subclasses of NSURLHandle must override this method.

    Import Statement

    Objective-C

    @import Foundation;

    Availability

    Deprecated in OS X v10.4 and later.

  • Returns the class of the URL handle that will be used for a specified URL.

    Deprecation Statement

    Use NSURLConnection or NSURLDownload instead; see URL Loading System Programming Guide.

    Declaration

    Objective-C

    + (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 YEStrue is selected.

    Import Statement

    Objective-C

    @import Foundation;

    Availability

    Deprecated in OS X v10.4 and later.

  • canInitWithURL: + canInitWithURL: (OS X v10.4) and later

    Returns whether a URL handle can be initialized with a given URL.

    Deprecation Statement

    Use NSURLConnection or NSURLDownload instead; see URL Loading System Programming Guide.

    Declaration

    Objective-C

    + (BOOL)canInitWithURL:(NSURL *)aURL

    Parameters

    aURL

    The URL in question.

    Return Value

    YEStrue if a URL handle can be initialized with aURL, NOfalse otherwise.

    Discussion

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

    Import Statement

    Objective-C

    @import Foundation;

    Availability

    Deprecated in OS X v10.4 and later.

  • Registers a subclass of NSURLHandle as an available subclass for handling URLs

    Deprecation Statement

    Use NSURLConnection or NSURLDownload instead; see URL Loading System Programming Guide.

    Declaration

    Objective-C

    + (void)registerURLHandleClass:(Class)aURLHandleSubclass

    Parameters

    aURLHandleSubclass

    The new subclass to register as an available subclass.

    Import Statement

    Objective-C

    @import Foundation;

    Availability

    Deprecated in OS X v10.4 and later.

  • addClient: - addClient: (OS X v10.4) and later

    Adds a client of the URL handle.

    Deprecation Statement

    Use NSURLConnection or NSURLDownload instead; see URL Loading System Programming Guide.

    Declaration

    Objective-C

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

    Parameters

    client

    An object conforming to the NSURLHandleClient protocol.

    Import Statement

    Objective-C

    @import Foundation;

    Availability

    Deprecated in OS X v10.4 and later.

  • removeClient: - removeClient: (OS X v10.4) and later

    Removes client as an NSURLHandleClient of the receiver.

    Deprecation Statement

    Use NSURLConnection or NSURLDownload instead; see URL Loading System Programming Guide.

    Declaration

    Objective-C

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

    Parameters

    client

    An object conforming to the NSURLHandleClient protocol.

    Import Statement

    Objective-C

    @import Foundation;

    Availability

    Deprecated in OS X v10.4 and later.

  • writeData: - writeData: (OS X v10.4) and later

    Attempts to write a specified set of data to the location specified by the receiver’s URL.

    Deprecation Statement

    Use NSURLConnection or NSURLDownload instead; see URL Loading System Programming Guide.

    Declaration

    Objective-C

    - (BOOL)writeData:(NSData *)data

    Parameters

    data

    The data to write.

    Return Value

    YEStrue if successful, NOfalse otherwise.

    Discussion

    Must be overridden by subclasses.

    Import Statement

    Objective-C

    @import Foundation;

    Availability

    Deprecated in OS X v10.4 and later.

Data Types