Class: NSURL

Inherits:
NSObject show all

Overview

An NSURL object lets you manipulate URLs and the resources they reference. The URLs employed by the NSURL class are described in RFCs 1808, 1738, and 2732. The litmus test for conformance to RFC 1808 is as recommended in RFC 1808—specifically, whether the first two characters of resourceSpecifier are slashes (//).

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from NSObject

#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version

Constructor Details

This class inherits a constructor from NSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NSObject

Class Method Details

+ (NSData) bookmarkDataWithContentsOfURL(bookmarkFileURL, error:error)

Initializes and returns bookmark data derived from an alias file pointed to by a specified URL. If bookmarkFileURL points to an alias file created prior to OS X v10.6 that contains Alias Manager information but no bookmark data, this method synthesizes bookmark data for the file.This method returns nil if bookmark data cannot be created.

Parameters:

  • bookmarkFileURL (NSURL)

    The URL that points to the alias file.

  • error (Pointer)

    The error that occurred in the case that the bookmark data cannot be derived.

Returns:

  • (NSData)

    The bookmark data for the alias file.

+ (Object) fileURLWithPath(path)

Initializes and returns a newly created NSURL object as a file URL with a specified path. This method assumes that path is a directory if it ends with a slash. If path does not end with a slash, the method examines the file system to determine if path is a file or a directory. If path exists in the file system and is a directory, the method appends a trailing slash. If path does not exist in the file system, the method assumes that it represents a file and does not append a trailing slash.As an alternative, consider using fileURLWithPath:isDirectory:, which allows you to explicitly specify whether the returned NSURL object represents a file or directory.

Parameters:

  • path (String)

    The path that the NSURL object will represent. path should be a valid system path. If path begins with a tilde, it must first be expanded with stringByExpandingTildeInPath. If path is a relative path, it is treated as being relative to the current working directory.Passing nil for this parameter produces an exception.

Returns:

+ (Object) fileURLWithPath(path, isDirectory:isDir)

Initializes and returns a newly created NSURL object as a file URL with a specified path.

Parameters:

  • path (String)

    The path that the NSURL object will represent. path should be a valid system path. If path begins with a tilde, it must first be expanded with stringByExpandingTildeInPath. If path is a relative path, it is treated as being relative to the current working directory.Passing nil for this parameter produces an exception.

  • isDir (Boolean)

    A Boolean value that specifies whether path is treated as a directory path when resolving against relative path components. Pass YES if the path indicates a directory, NO otherwise.

Returns:

+ (NSURL) fileURLWithPathComponents(components)

Initializes and returns a newly created NSURL object as a file URL with specified path components. The path components are separated by a forward slash in the returned URL.

Parameters:

  • components (Array)

    An array of path components.Passing nil for this parameter produces an exception.

Returns:

  • (NSURL)

    An NSURL object initialized with components.

+ (Hash) resourceValuesForKeys(keys, fromBookmarkData:bookmarkData)

Returns the resource values for properties identified by a specified array of keys contained in specified bookmark data.

Parameters:

  • keys (Array)

    An array of names of URL resource properties.

  • bookmarkData (NSData)

    The bookmark data the resource values are derived from.

Returns:

  • (Hash)

    A dictionary of the requested resource values contained in bookmarkData.

+ (Object) URLByResolvingBookmarkData(bookmarkData, options:options, relativeToURL:relativeURL, bookmarkDataIsStale:isStale, error:error)

Returns a new URL made by resolving bookmark data. To obtain a security-scoped URL from a security-scoped bookmark, call this method using the NSURLBookmarkResolutionWithSecurityScope option. In addition, to use security scope, you must first have enabled the appropriate entitlements for your app, as described in “Enabling Security-Scoped Bookmark and URL Access” in Entitlement Key Reference.To then obtain access to the file-system resource pointed to by a security-scoped URL (in other words, to bring the resource into your app’s sandbox), call the startAccessingSecurityScopedResource method (or its Core Foundation equivalent) on the URL.For an app-scoped bookmark, no sandboxed app other than the one that created the bookmark can obtain access to the file-system resource that the URL (obtained from the bookmark) points to.For a document-scoped bookmark, any sandboxed app that has access to the bookmark data itself, and has access to the document that owns the bookmark, can obtain access to the resource.Version note: Security-scoped bookmarks are not available in versions of OS X prior to OS X v10.7.3.

Parameters:

  • bookmarkData (NSData)

    The bookmark data the URL is derived from.

  • options (NSURLBookmarkResolutionOptions)

    Options taken into account when resolving the bookmark data.To resolve a security-scoped bookmark to support App Sandbox, you must include (by way of bitwise OR operators with any other options in this parameter) the NSURLBookmarkResolutionWithSecurityScope option.

  • relativeURL (NSURL)

    The base URL that the bookmark data is relative to.If you are resolving a security-scoped bookmark to obtain a security-scoped URL, use this parameter as follows:To resolve an app-scoped bookmark, use a value of nil.To resolve a document-scoped bookmark, use the absolute path (despite this parameter’s name) to the document from which you retrieved the bookmark.

  • isStale (Boolean)

    If YES, the bookmark data is stale.

  • error (Pointer)

    The error that occurred in the case that the URL cannot be created.

Returns:

  • (Object)

    A new URL made by resolving bookmarkData.

+ (Object) URLWithString(URLString)

Creates and returns an NSURL object initialized with a provided string. This method expects URLString to contain any necessary percent escape codes, which are ‘:’, ‘/’, ‘%’, ‘#’, ‘;’, and ‘@’. Note that ‘%’ escapes are translated via UTF-8.

Parameters:

  • URLString (String)

    The string with which to initialize the NSURL object. Must be a URL that conforms to RFC 2396. This method parses URLString according to RFCs 1738 and 1808. (To create NSURL objects for file system paths, use fileURLWithPath:isDirectory: instead.)

Returns:

  • (Object)

    An NSURL object initialized with URLString. If the string was malformed, returns nil.

+ (Object) URLWithString(URLString, relativeToURL:baseURL)

Creates and returns an NSURL object initialized with a base URL and a relative string. This method expects URLString to contain any necessary percent escape codes.

Parameters:

  • URLString (String)

    The string with which to initialize the NSURL object. May not be nil. Must conform to RFC 2396. URLString is interpreted relative to baseURL.

  • baseURL (NSURL)

    The base URL for the NSURL object.

Returns:

  • (Object)

    An NSURL object initialized with URLString and baseURL. If URLString was malformed, returns nil.

+ (Boolean) writeBookmarkData(bookmarkData, toURL:bookmarkFileURL, options:options, error:error)

Creates an alias file on disk at a specified location with specified bookmark data. This method will produce an error if bookmarkData was not created with the NSURLBookmarkCreationSuitableForBookmarkFile option.If bookmarkFileURL points to a directory, the alias file will be created in that directory with its name derived from the information in bookmarkData. If bookmarkFileURL points to a file, the alias file will be created with the location and name indicated by bookmarkFileURL, and its extension will be changed to .alias if it is not already.

Parameters:

  • bookmarkData (NSData)

    The bookmark data containing information for the alias file.

  • bookmarkFileURL (NSURL)

    The desired location of the alias file.

  • options (NSURLBookmarkFileCreationOptions)

    Options taken into account when creating the alias file.

  • error (Pointer)

    The error that occurred in the case that the alias file cannot be created.

Returns:

  • (Boolean)

    YES if the alias file is successfully created; otherwise, NO.

Instance Method Details

- (String) absoluteString

Returns the string for the receiver as if it were an absolute URL.

Returns:

  • (String)

    An absolute string for the URL. Creating by resolving the receiver's string against its base according to the algorithm given in RFC 1808.

- (NSURL) absoluteURL

Returns an absolute URL that refers to the same resource as the receiver.

Returns:

  • (NSURL)

    An absolute URL that refers to the same resource as the receiver. If the receiver is already absolute, returns self. Resolution is performed per RFC 1808.

- (NSURL) baseURL

Returns the base URL of the receiver.

Returns:

  • (NSURL)

    The base URL of the receiver. If the receiver is an absolute URL, returns nil.

- (NSData) bookmarkDataWithOptions(options, includingResourceValuesForKeys:keys, relativeToURL:relativeURL, error:error)

Returns a bookmark for the URL, created with specified options and resource values. To use this method to create a security-scoped bookmark to support App Sandbox, you must first have enabled the appropriate entitlements for your app, as described in “Enabling Security-Scoped Bookmark and URL Access” in Entitlement Key Reference. In addition, be sure to understand the behavior of the options and relativeURL parameters.For an app-scoped bookmark, no sandboxed app other than the one that created the bookmark can obtain access to the file-system resource that the URL (obtained from the bookmark) points to. Specifically, a bookmark created with security scope fails to resolve if the caller does not have the same code signing identity as the caller that created the bookmark.For a document-scoped bookmark, any sandboxed app that has access to the bookmark data itself, and has access to the document that owns the bookmark, can obtain access to the resource.Version note: Security-scoped bookmarks are not available in versions of OS X prior to OS X v10.7.3.

Parameters:

  • options (NSURLBookmarkCreationOptions)

    Options taken into account when creating the bookmark for the URL.To create a security-scoped bookmark to support App Sandbox, include (by way of bitwise OR operators with any other options in this parameter) the NSURLBookmarkCreationWithSecurityScope option.When you later resolve the bookmark, you can use the resulting security-scoped URL to obtain read/write access to the file-system resource pointed to by the URL.If you instead want to create a security-scoped bookmark that, when resolved, enables you to obtain read-only access to a file-system resource, bitwise OR this parameter’s value with both the NSURLBookmarkCreationWithSecurityScope option and the NSURLBookmarkCreationSecurityScopeAllowOnlyReadAccess option.

  • keys (Array)

    An array of names of URL resource properties.

  • relativeURL (NSURL)

    The URL that the bookmark data will be relative to.If you are creating a security-scoped bookmark to support App Sandbox, use this parameter as follows:To create an app-scoped bookmark, use a value of nil. To create a document-scoped bookmark, use the absolute path (despite this parameter’s name) to the document file that is to own the new security-scoped bookmark.

  • error (Pointer)

    The error that occurred in the case that the bookmark data cannot be created.

Returns:

  • (NSData)

    A bookmark for the URL.

- (Boolean) checkResourceIsReachableAndReturnError(error)

Returns whether the resource pointed to by a file URL can be reached.

Parameters:

  • error (Pointer)

    The error that occurred in the case that the resource cannot be reached.

Returns:

  • (Boolean)

    YES if the resource is reachable; otherwise, NO.

- (NSURL) filePathURL

Returns a new file path URL that points to the same resource as the original URL. If the original URL is a file reference URL, this method converts it to a file path URL. If the original URL is a file path URL, the returned URL is identical. If the original URL is not a file URL, this method returns nil.

Returns:

  • (NSURL)

    The new file path URL.

- (NSURL) fileReferenceURL

Returns a new file reference URL that points to the same resource as the original URL. If the original URL is a file path URL, this method converts it to a file reference URL. If the original URL is a file reference URL, the returned URL is identical. If the original URL is not a file URL, this method returns nil.

Returns:

  • (NSURL)

    The new file reference URL.

- (String) fragment

Returns the fragment of a URL conforming to RFC 1808.

Returns:

  • (String)

    The fragment of the URL. If the receiver does not conform to RFC 1808, returns nil.

- (Boolean) getResourceValue(value, forKey:key, error:error)

Returns the resource value for the property identified by a given key. value is set to nil if the requested resource value is not defined for the URL. In this case, the method still returns YES.

Parameters:

  • value (Object)

    The value for the property identified by key.

  • key (String)

    The name of one of the URL’s resource properties.

  • error (Pointer)

    The error that occurred in the case that the resource value cannot be retrieved.

Returns:

  • (Boolean)

    YES if value is successfully populated; otherwise, NO.

- (String) host

Returns the host of a URL conforming to RFC 1808.

Returns:

  • (String)

    The host of the URL. If the receiver does not conform to RFC 1808, returns nil.

- (Object) initByResolvingBookmarkData(bookmarkData, options:options, relativeToURL:relativeURL, bookmarkDataIsStale:isStale, error:error)

Initializes a newly created NSURL that points to a location specified by resolving bookmark data.

Parameters:

  • bookmarkData (NSData)

    The bookmark data the URL is derived from.

  • options (NSURLBookmarkResolutionOptions)

    Options taken into account when resolving the bookmark data.

  • relativeURL (NSURL)

    The base URL that the bookmark data is relative to.

  • isStale (Boolean)

    If YES, the bookmark data is stale.

  • error (Pointer)

    The error that occurred in the case that the URL cannot be created.

Returns:

  • (Object)

    An NSURL initialized by resolving bookmarkData.

- (Object) initFileURLWithPath(path)

Initializes a newly created NSURL referencing the local file or directory at path. Invoking this method is equivalent to invoking initWithScheme:host:path: with scheme NSURLFileScheme, a nil host, and path.This method examines path in the file system to determine if it is a directory. If path is a directory, then a trailing slash is appended. If the file does not exist, it is assumed that path represents a directory and a trailing slash is appended. As an alternative, consider using initFileURLWithPath:isDirectory: which allows you to explicitly specify whether the returned NSURL represents a file or directory.

Parameters:

  • path (String)

    The path that the NSURL object will represent. path should be a valid system path. If path begins with a tilde, it must first be expanded with stringByExpandingTildeInPath. If path is a relative path, it is treated as being relative to the current working directory.Passing nil for this parameter produces an exception.

Returns:

- (Object) initFileURLWithPath(path, isDirectory:isDir)

Initializes a newly created NSURL referencing the local file or directory at path. Invoking this method is equivalent to invoking initWithScheme:host:path: with scheme NSURLFileScheme, a nil host, and path.

Parameters:

  • path (String)

    The path that the NSURL object will represent. path should be a valid system path. If path begins with a tilde, it must first be expanded with stringByExpandingTildeInPath. If path is a relative path, it is treated as being relative to the current working directory.Passing nil for this parameter produces an exception.

  • isDir (Boolean)

    A Boolean value that specifies whether path is treated as a directory path when resolving against relative path components. Pass YES if the path indicates a directory, NO otherwise

Returns:

- (Object) initWithScheme(scheme, host:host, path:path)

Initializes a newly created NSURL with a specified scheme, host, and path. This method automatically escapes path with the stringByAddingPercentEscapesUsingEncoding: method.

Parameters:

  • scheme (String)

    The scheme for the NSURL object.

  • host (String)

    The host for the NSURL object. May be the empty string.

  • path (String)

    The path for the NSURL object. If path begins with a tilde, it must first be expanded with stringByExpandingTildeInPath.

Returns:

- (Object) initWithString(URLString)

Initializes an NSURL object with a provided string. This method expects URLString to contain any necessary percent escape codes, which are ‘:’, ‘/’, ‘%’, ‘#’, ‘;’, and ‘@’. Note that ‘%’ escapes are translated via UTF-8.

Parameters:

  • URLString (String)

    The string with which to initialize the NSURL object. This string must conform to URL format as described in RFC 2396. This method parses URLString according to RFCs 1738 and 1808.

Returns:

  • (Object)

    An NSURL object initialized with URLString. If the string was malformed, returns nil.

- (Object) initWithString(URLString, relativeToURL:baseURL)

Initializes an NSURL object with a base URL and a relative string. This method expects URLString to contain any necessary percent escape codes.initWithString:relativeToURL: is the designated initializer for NSURL.

Parameters:

  • URLString (String)

    The string with which to initialize the NSURL object. Must conform to RFC 2396. URLString is interpreted relative to baseURL.

  • baseURL (NSURL)

    The base URL for the NSURL object.

Returns:

  • (Object)

    An NSURL object initialized with URLString and baseURL. If URLString was malformed, returns nil.

- (Boolean) isEqual(anObject)

Returns a Boolean value that indicates whether the receiver and a given object are equal. This method defines what it means for instances to be equal. Two NSURLs are considered equal if and only if they return identical values for both baseURL and relativeString.

Parameters:

  • anObject (Object)

    The object to be compared to the receiver.

Returns:

  • (Boolean)

    YES if the receiver and anObject are equal, otherwise NO.

- (Boolean) isFileReferenceURL

Returns whether the URL is a file reference URL.

Returns:

  • (Boolean)

    YES if the URL is a file reference URL; otherwise, NO.

- (Boolean) isFileURL

Returns whether the receiver uses the file scheme.

Returns:

  • (Boolean)

    Returns YES if the receiver uses the file scheme, NO otherwise.

- (String) lastPathComponent

Returns the last path component of a file URL.

Returns:

  • (String)

    The last path component of the URL.

- (String) parameterString

Returns the parameter string of a URL conforming to RFC 1808.

Returns:

  • (String)

    The parameter string of the URL. If the receiver does not conform to RFC 1808, returns nil.

- (String) password

Returns the password of a URL conforming to RFC 1808.

Returns:

  • (String)

    The password of the URL. If the receiver does not conform to RFC 1808, returns nil.

- (String) path

Returns the path of a URL conforming to RFC 1808.

Returns:

  • (String)

    The path of the URL, unescaped with the stringByReplacingPercentEscapesUsingEncoding: method. If the receiver does not conform to RFC 1808, returns nil.If this URL object contains a file URL (as determined with isFileURL), the return value of this method is suitable for input into methods of NSFileManager or NSPathUtilities. If the path has a trailing slash it is stripped.Per RFC 3986, the leading slash after the authority (host name and port) portion is treated as part of the path.

- (Array) pathComponents

Returns the individual path components of a file URL in an array.

Returns:

  • (Array)

    An array containing the individual path components of the URL.

- (String) pathExtension

Returns the path extension of a file URL.

Returns:

  • (String)

    The path extension of the URL.

- (NSNumber) port

Returns the port number of a URL conforming to RFC 1808.

Returns:

  • (NSNumber)

    The port number of the URL. If the receiver does not conform to RFC 1808, returns nil.

- (String) query

Returns the query of a URL conforming to RFC 1808.

Returns:

  • (String)

    The query of the URL. If the receiver does not conform to RFC 1808, returns nil.

- (String) relativePath

Returns the path of a URL conforming to RFC 1808, without resolving against the receiver’s base URL.

Returns:

  • (String)

    The relative path of the URL without resolving against the base URL. If the receiver is an absolute URL, this method returns the same value as path. If the receiver does not conform to RFC 1808, returns nil.

- (String) relativeString

Returns a string representation of the relative portion of the URL.

Returns:

  • (String)

    A string representation of the relative portion of the URL. If the receiver is an absolute URL this method returns the same value as absoluteString.

- (String) resourceSpecifier

Returns the resource specifier of the URL.

Returns:

  • (String)

    The resource specifier of the URL.

- (Hash) resourceValuesForKeys(keys, error:error)

Returns the resource values for the properties identified by specified array of keys. If an error occurs, this method returns nil. A key is left out of the returned dictionary if its corresponding resource value is not defined for the URL.

Parameters:

  • keys (Array)

    An array of names of URL resource properties.

  • error (Pointer)

    The error that occurred in the case that one or more resource values cannot be retrieved.

Returns:

  • (Hash)

    A dictionary of resource values indexed by key.

- (String) scheme

Returns the scheme of the URL.

Returns:

  • (String)

    The scheme of the URL.

- (Boolean) setResourceValue(value, forKey:key, error:error)

Sets the resource property of the URL specified by a given key to a given value. The resource is modified synchronously.

Parameters:

  • value (Object)

    The value for the resource property defined by key.

  • key (String)

    The name of one of the URL’s resource properties.

  • error (Pointer)

    The error that occurred in the case that the resource value cannot be set.

Returns:

  • (Boolean)

    YES if the resource property named key is successfully set to value; otherwise, NO.

- (Boolean) setResourceValues(keyedValues, error:error)

Sets resource properties of the URL specified by a given set of keys to a given set of values. If an error occurs during the execution of this method, error will contain an array of the resource values that were not successfully set in its userInfo dictionary.

Parameters:

  • keyedValues (Hash)

    A dictionary of resource values to be set.

  • error (Pointer)

    The error that occurred in the case that one or more resource values cannot be set.

Returns:

  • (Boolean)

    YES if all resource values in keyedValues are successfully set; otherwise, NO.

- (NSURL) standardizedURL

Returns a new NSURL object with any instances of ".." or "." removed from its path.

Returns:

  • (NSURL)

    A new NSURL object initialized with a version of the receiver’s URL that has had any instances of “..” or “.” removed from its path.

- (NSURL) URLByAppendingPathComponent(pathComponent)

Returns a new URL made by appending a path component to the original URL. If the original URL does not end with a forward slash and pathComponent does not begin with a forward slash, a forward slash is inserted between the two parts of the returned URL, unless the original URL is the empty string.

Parameters:

  • pathComponent (String)

    The path component to add to the URL.

Returns:

  • (NSURL)

    A new URL with pathComponent appended.

- (NSURL) URLByAppendingPathComponent(pathComponentisDirectory, :isDirectory)

Returns a new URL made by appending a path component to the original URL, along with a trailing slash if the component is designated a directory. If the original URL does not end with a forward slash and pathComponent does not begin with a forward slash, a forward slash is inserted between the two parts of the returned URL, unless the original URL is the empty string.

Parameters:

  • pathComponent (String)

    The path component to add to the URL.

  • isDirectory (Boolean)

    If TRUE, a trailing slash is appended after pathComponent.

Returns:

  • (NSURL)

    A new URL with pathComponent appended.

- (NSURL) URLByAppendingPathExtension(pathExtension)

Returns a new URL made by appending a path extension to the original URL. If the original URL ends with one or more forward slashes, these are removed from the returned URL. A period is inserted between the two parts of the new URL.

Parameters:

  • pathExtension (String)

    The path extension to add to the URL.

Returns:

  • (NSURL)

    A new URL with pathExtension appended.

- (NSURL) URLByDeletingLastPathComponent

Returns a new URL made by deleting the last path component from the original URL. If the original URL represents the root path, the returned URL is identical. Otherwise, if the original URL has only one path component, the new URL is the empty string.

Returns:

  • (NSURL)

    A new URL with the last path component of the original URL removed.

- (NSURL) URLByDeletingPathExtension

Returns a new URL made by deleting the path extension, if any, from the original URL. If the original URL represents the root path, the returned URL is identical. If the URL has multiple path extensions, only the last one is removed.

Returns:

  • (NSURL)

    A new URL with the path extension of the original URL removed.

- (NSURL) URLByResolvingSymlinksInPath

Returns a new URL that points to the same resource as the original URL and includes no symbolic links. If the original URL has no symbolic links, the returned URL is identical to the original URL.This method only works on URLs with the file: path scheme. This method will return an identical URL for all other URLs.

Returns:

  • (NSURL)

    A new URL that points to the same resource as the original URL and includes no symbolic links.

- (NSURL) URLByStandardizingPath

Returns a new URL that points to the same resource as the original URL and is an absolute path. This method only works on URLs with the file: path scheme. This method will return an identical URL for all other URLs.

Returns:

  • (NSURL)

    A new URL that points to the same resource as the original URL and is an absolute path.

- (String) user

Returns the user portion of a URL conforming to RFC 1808.

Returns:

  • (String)

    The user portion of the URL. If the receiver does not conform to RFC 1808, returns nil.