Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSURLMBS class.

NSURLMBS.checkResourceIsReachableAndReturnError as NSErrorMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns whether the URL's resource exists and is reachable.

This method synchronously checks if the resource's backing store is reachable. Checking reachability is appropriate when making decisions that do not require other immediate operations on the resource, e.g. periodic maintenance of UI state that depends on the existence of a specific document. When performing operations such as opening a file or copying resource properties, it is more efficient to simply try the operation and handle failures. If this method returns false, the optional error is populated. This method is currently applicable only to URLs for file system resources. For other URL types, NO is returned. Symbol is present in iOS 4, but performs no operation.

NSURLMBS.Constructor(item as folderitem)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates an URL based on folderItem.

See also:

NSURLMBS.Constructor(scheme as string, host as string, path as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Initializes a newly created NSURL with a specified scheme, host, and path.

scheme: The scheme for the NSURL object. For example, in the URL http://www.example.com/index.html, the scheme is http.
host: The host for the NSURL object (for example, www.example.com). May be the empty string.
path: The path for the NSURL object (for example, /index.html). If the path begins with a tilde, you must first expand it by calling stringByExpandingTildeInPath.

See also:

NSURLMBS.Constructor(url as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates and returns an NSURL object initialized with a provided URL string.

See also:

NSURLMBS.Constructor(url as string, baseURL as NSURLMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates and returns an NSURL object initialized with a base URL and a relative string.

This method allows you to create a URL relative to a base path or URL. For example, if you have the URL for a folder on disk and the name of a file within that folder, you can construct a URL for the file by providing the folder’s URL as the base path (with a trailing slash) and the filename as the string part.

This method expects URLString to contain only characters that are allowed in a properly formed URL. All other characters must be properly percent escaped. Any percent-escaped characters are interpreted using UTF-8 encoding.

See also:

NSURLMBS.copy as NSURLMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a copy of the URL object.

NSURLMBS.getResourceValue(byref value as Variant, key as string, byref error as NSErrorMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the value of the resource property for the specified key.

value: The location where the value for the resource property identified by key should be stored.
key: The name of one of the URL’s resource properties.
error: The error that occurred if the resource value could not be retrieved.

Returns true if value is successfully populated; otherwise, false.

This method first checks if the URL object already caches the resource value. If so, it returns the cached resource value to the caller. If not, then this method synchronously obtains the resource value from the backing store, adds the resource value to the URL object's cache, and returns the resource value to the caller.

The type of the returned resource value varies by resource property; for details, see the documentation for the key you want to access.

If this method returns true and the value is populated with nil, it means that the resource property is not available for the specified resource, and that no errors occurred when determining that the resource property was unavailable.

If this method returns false, an error occurred. The object pointer referenced by error is populated with additional information.

This method applies only to URLs that represent file system resources.

Available in OS X v10.6 and later.

Automatic type translation applies (See FAQ about NSDictionary).
e.g. NSNumber can be converted to Integer or Boolean depending on content.

Some examples using this method:

NSURLMBS.isEqual(other as NSURLMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Tests if two NSURLs are equal.

Returns a Boolean value that indicates whether the receiver and a given object have identical URL strings and base URLs.

NSURLMBS.Items(byref error as NSErrorMBS, VisibleItemsOnly as boolean = false) as NSURLMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Queries list of items in the directory the URL points to on disk.

Error is optional.

See also:

NSURLMBS.Items(VisibleItemsOnly as boolean = false) as NSURLMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Queries list of items in the directory the URL points to on disk.

See also:

NSURLMBS.pathComponents as string()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
An array containing the path components. (read-only)

This property contains an array containing the individual path components of the URL. For example, in the URL file:///directory/directory2/file, the path components array would be "/", "directory", "directory2", "file".

NSURLMBS.removeAllCachedResourceValues

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Removes all cached resource values and temporary resource values from the URL object.

This method is applicable only to URLs that represent file system resources.
Available in OS X v10.9 and later.

NSURLMBS.removeCachedResourceValueForKey(key as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Removes the cached resource value identified by a given key from the URL object.

key: The resource value key whose cached values you want to remove.

Removing a cached resource value may remove other cached resource values because some resource values are cached as a set of values, and because some resource values depend on other resource values. (Temporary resource values have no dependencies.)

This method is currently applicable only to URLs for file system resources.

Available in OS X v10.9 and later.

NSURLMBS.resourceValuesForKeys(keys() as string, byref error as NSErrorMBS) as Dictionary

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the resource values for the properties identified by specified array of keys.

Returns a dictionary of resource values indexed by key.

This method first checks if the URL object already caches the specified resource values. If so, it returns the cached resource values to the caller. If not, then this method synchronously obtains the resource values from the backing store, adds the resource values to the URL object's cache, and returns the resource values to the caller.

The type of the returned resource value varies by resource property; for details, see the documentation for the key you want to access.

If the result dictionary does not contain a resource value for one or more of the requested resource keys, it means those resource properties are not available for the URL, and no errors occurred when determining those resource properties were not available.

If an error occurs, this method returns nil and populates the object pointer referenced by error with additional information.

This method applies only to URLs that represent file system resources.
Available in OS X v10.6 and later.

See also:

Some examples using this method:

NSURLMBS.resourceValuesForKeys(keys() as string, targetDelegate as ResourceValuesForKeysDelegateMBS, tag as Variant = nil, PrecacheIcons as boolean = false)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Query keys asynchronously.

The plugin will query values on a different preemptive thread and call your delegate on main thread with results as soon as possible. This way you can keep app responsive while system e.g. loads icons.
For icons, you can set PrecacheIcons to true. In that case plugin will draw icon on the preemptive thread, so icon data is really loaded from disk. When you than draw on main thread, it's really quick.

The delegate has this parameters:
ResourceValuesForKeysDelegateMBS(URL as NSURLMBS, keys() as String, Values as Dictionary, Error as NSErrorMBS, tag as Variant)

See also:

NSURLMBS.setResourceValue(value as Variant, key as string, byref error as NSErrorMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the URL’s resource property for a given key to a given value.

value: The value for the resource property defined by key.
key: The name of one of the URL’s resource properties.
error: The error that occurred if the resource value could not be set.

Returns true if the resource property named key is successfully set to value; otherwise, false.

This method synchronously writes the new resource value out to disk. Attempts to set a read-only resource property or to set a resource property that is not supported by the resource are ignored and are not considered errors.

If an error occurs, this method returns NO and populates the object pointer referenced by error with additional information.

This method applies only to URLs for file system resources.
Available in OS X v10.6 and later.

Automatic type translation applies (See FAQ about NSDictionary).

NSURLMBS.setResourceValues(keyedValues as Dictionary, byref error as NSErrorMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets the URL’s resource properties for a given set of keys to a given set of values.

keyedValues: A dictionary of resource values to be set.
error: The error that occurred if one or more resource values could not be set.

Returns true if all resource values in keyedValues are successfully set; otherwise, false.

This method synchronously writes the new resource value out to disk. If an error occurs after some resource properties have been successfully changed, the userInfo dictionary in the returned error object contains a kCFURLKeysOfUnsetValuesKey key whose value is an array of the resource values that were not successfully set.

Attempts to set a read-only resource property or to set a resource property that is not supported by the resource are ignored and are not considered errors.

The order in which the resource values are set is not defined. If you need to guarantee the order in which resource values are set, you should make multiple requests to this method or setResourceValue:forKey:error:.

This method applies only to URLs for file system resources.
Available in OS X v10.6 and later.

Automatic type translation applies (See FAQ about NSDictionary).

NSURLMBS.setTemporaryResourceValue(value as Variant, key as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Sets a temporary resource value on the URL object.

value: The value to store.
key: The key where the value should be stored. This key must be unique and must not conflict with any system-defined keys. Reverse-domain-name notation is recommended.

Your app can use a temporary resource value to temporarily store a value for an app-defined resource value key in memory without modifying the actual resource that the URL represents. Once set, you can copy the temporary resource value from the URL object just as you would copy system-defined keys—by calling getResourceValue or resourceValuesForKeys.

Your app can remove a temporary resource value from the URL object by calling removeCachedResourceValueForKey or removeAllCachedResourceValues (to remove all temporary values).

This method is applicable only to URLs for file system resources.
Available in OS X v10.9 and later.

NSURLMBS.startAccessingSecurityScopedResource as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Starts accessing a security scoped bookmark URL.

Given a NSURL created by resolving a bookmark data created with security scope, make the resource referenced by the url accessible to the process. When access to this resource is no longer needed the client must call stopAccessingSecurityScopedResource. Each call to startAccessingSecurityScopedResource must be balanced with a call to stopAccessingSecurityScopedResource (Note: this is not reference counted).

NSURLMBS.stopAccessingSecurityScopedResource

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Revokes the access granted to the url by a prior successful call to startAccessingSecurityScopedResource.

NSURLMBS.TagNames as string()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The names of tags attached to the resource, returned as an array of String values.

Available in OS X v10.9 and later.

NSURLMBS.URLByAppendingPathComponent(pathComponent as string) as NSURLMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a new URL made by appending a path component to the original URL.

pathComponent: The path component to add to the URL, in its original form (not URL encoded).

Returns a new URL with pathComponent appended.

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.

Available in OS X v10.6 and later.

See also:

NSURLMBS.URLByAppendingPathComponent(pathComponent as string, isDirectory as boolean) as NSURLMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
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.

pathComponent: The path component to add to the URL.
isDirectory: If true, a trailing slash is appended after pathComponent.

Returns a new URL with pathComponent appended.

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.

Available in OS X v10.7 and later.
On Mac OS X 10.6 the plugin falls back

See also:

NSURLMBS.URLByAppendingPathExtension(PathExtension as string) as NSURLMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a new URL made by appending a path extension to the original URL.

pathExtension: The path extension to add to the URL.

Returns a new URL with pathExtension appended.

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.
Available in OS X v10.6 and later.

NSURLMBS.URLByDeletingLastPathComponent as NSURLMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
A URL created by taking the receiver and removing the last path component.

If the receiver’s URL represents the root path, this property contains a copy of the original URL. Otherwise, if the original URL has only one path component, this property contains the empty string.

Available in OS X v10.6 and later.

NSURLMBS.URLByDeletingPathExtension as NSURLMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
A URL created by taking the receiver and removing the path extension, if any.

If the receiver represents the root path, this property contains a copy of the original URL. If the URL has multiple path extensions, only the last one is removed.

Available in OS X v10.6 and later.

NSURLMBS.URLByResolvingSymlinksInPath as NSURLMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
A URL that points to the same resource as the receiver and includes no symbolic links.

If the receiver has no symbolic links, this property contains a copy of the original URL.

If some symbolic links cannot be resolved, this property contains those broken symbolic links.

If the name of the receiving path begins with /private, this property strips off the /private designator, provided the result is the name of an existing file.

This property only works on URLs with the file: path scheme. For all other URLs, it contains a copy of the receiver.
Available in OS X v10.6 and later.

NSURLMBS.URLByStandardizingPath as NSURLMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Networking MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes All
A URL that points to the same resource as the original URL using an absolute path.

This property only works on URLs with the file: path scheme. For all other URLs, it returns a copy of the original URL.

Like stringByStandardizingPath, this property can make the following changes in the provided URL:

  • Expand an initial tilde expression using stringByExpandingTildeInPath.
  • Reduce empty components and references to the current directory (that is, the sequences "//" and "/./") to single path separators.
  • In absolute paths only, resolve references to the parent directory (that is, the component "..") to the real parent directory if possible using stringByResolvingSymlinksInPath, which consults the file system to resolve each potential symbolic link.
  • In relative paths, because symbolic links can’t be resolved, references to the parent directory are left in place.
  • Remove an initial component of "/private" from the path if the result still indicates an existing file or directory (checked by consulting the file system).

Note that the path contained by this property may still have symbolic link components in it. Note also that this property only works with file paths (not, for example, string representations of URLs).

Available in OS X v10.6 and later.

The items on this page are in the following plugins: MBS MacBase Plugin.


The biggest plugin in space...