Name

NSURL — Mac OS X 10.0

Synopsis

NSURL is a class that represents a URL—the human-readable host names and paths that various networking clients use to locate both remote resources over a network, or resources on the local filesystem. Core Foundation has a type, CFURL, that is toll-free bridged to NSURL, and as such the two types can be used interchangeably.

image with no caption

@interface NSURL : NSObject
                                  // Accessor Methods
   - (BOOL)setResourceData:(NSData *)data;
   - (BOOL)setProperty:(id)property 
                                 forKey:(NSString *)propertyKey;
                                  // Class Methods
   + (NSURL *)URLFromPasteboard:(NSPasteboard *)pasteBoard;
   + (id)URLWithString:(NSString *)URLString;
   + (id)URLWithString:(NSString *)URLString 
                                 relativeToURL:(NSURL *)baseURL;
   + (id)fileURLWithPath:(NSString *)path;
                                  // Instance Methods
   - (NSURLHandle *)URLHandleUsingCache:(BOOL)shouldUseCache;
   - (id) initWithString:(NSString *)URLString;
   - (id) initWithString:(NSString *)URLString 
                                 relativeToURL:(NSURL *)baseURL;
   - (NSString *)absoluteString;
   - (NSURL *)absoluteURL;
   - (NSURL *)baseURL;
   - (NSString *)fragment;
   - (NSString *)host;
   - (BOOL)isFileURL;
   - (void)loadResourceDataNotifyingClient:(id)client 
                                 usingCache:(BOOL)shouldUseCache;
   - (NSString *)parameterString;
   - (NSString *)password;
   - (id) initFileURLWithPath:(NSString *)path;
   - (NSString *)path;
   - (NSNumber *)port;
   - (id)propertyForKey:(NSString *)propertyKey ...

Get Cocoa in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.