O'Reilly logo

Cocoa in a Nutshell by James Duncan Davidson, Michael Beam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required