Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

Previous items

NSFileManagerMBS.removeItem(path as string, byref error as NSErrorMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 13.4 Yes No No Yes, macOS only No
Function: Removes the file or directory at the specified path.
Notes:
path: A path string indicating the file or directory to remove. If the path specifies a directory, the contents of that directory are recursively removed.
error: If an error occurs, this is set to an actual error object containing the error information.

Returns true if the item was removed successfully or if path was nil. Returns false if an error occurred. If the delegate aborts the operation for a file, this method returns true. However, if the delegate aborts the operation for a directory, this method returns false.

Available in OS X v10.5 and later.

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.setAttributes(attributesDic as dictionary, item as folderitem, byref error as NSErrorMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 12.3 Yes No No Yes, macOS only No
Function: Sets the attributes of the specified file or directory.
Notes:
attributes: A dictionary containing as keys the attributes to set for path and as values the corresponding value for the attribute. You can set the following attributes: NSFileBusy, NSFileCreationDate, NSFileExtensionHidden, NSFileGroupOwnerAccountID, NSFileGroupOwnerAccountName, NSFileHFSCreatorCode, NSFileHFSTypeCode, NSFileImmutable, NSFileModificationDate, NSFileOwnerAccountID, NSFileOwnerAccountName, NSFilePosixPermissions. You can change single attributes or any combination of attributes; you need not specify keys for all attributes.
item: The folderitem of a file or directory.
error: If an error occurs, this is set to an actual error object containing the error information.

Returns true if all changes succeed. If any change fails, returns false, but it is undefined whether any changes actually occurred.

Discussion
As in the POSIX standard, the application either must own the file or directory or must be running as superuser for attribute changes to take effect. The method attempts to make all changes specified in attributes and ignores any rejection of an attempted modification. If the last component of the path is a symbolic link it is traversed.

The NSFilePosixPermissions value must be initialized with the code representing the POSIX file-permissions bit pattern. NSFileHFSCreatorCode and NSFileHFSTypeCode will only be heeded when path specifies a file.

Available in Mac OS X v10.5 and later.

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.setAttributes(attributesDic as dictionary, path as string, byref error as NSErrorMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 12.3 Yes No No Yes, macOS only No
Function: Sets the attributes of the specified file or directory.
Notes:
attributes: A dictionary containing as keys the attributes to set for path and as values the corresponding value for the attribute. You can set the following attributes: NSFileBusy, NSFileCreationDate, NSFileExtensionHidden, NSFileGroupOwnerAccountID, NSFileGroupOwnerAccountName, NSFileHFSCreatorCode, NSFileHFSTypeCode, NSFileImmutable, NSFileModificationDate, NSFileOwnerAccountID, NSFileOwnerAccountName, NSFilePosixPermissions. You can change single attributes or any combination of attributes; you need not specify keys for all attributes.
path: The path of a file or directory.
error: If an error occurs, this is set to an actual error object containing the error information.

Returns true if all changes succeed. If any change fails, returns false, but it is undefined whether any changes actually occurred.

Discussion
As in the POSIX standard, the application either must own the file or directory or must be running as superuser for attribute changes to take effect. The method attempts to make all changes specified in attributes and ignores any rejection of an attempted modification. If the last component of the path is a symbolic link it is traversed.

The NSFilePosixPermissions value must be initialized with the code representing the POSIX file-permissions bit pattern. NSFileHFSCreatorCode and NSFileHFSTypeCode will only be heeded when path specifies a file.

Available in Mac OS X v10.5 and later.

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.setUbiquitous(flag as boolean, item as folderitem, destitem as folderitem, byref error as NSErrorMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 11.3 Yes No No Yes, macOS only No
Function: Sets whether the item at the specified URL should be stored in the cloud.
Notes:
flag: Specify true to move the item to iCloud or false to remove it from iCloud (if it is there currently).
item: Specify the folderitem of the item (file or directory) that you want to store in iCloud.
destitem: Specify the location in iCloud at which to store the file or directory. This folderitem must be constructed from a folderitem returned by the URLForUbiquityContainerIdentifier method, which you use to retrieve the desired iCloud container directory. The folderitem you specify may contain additional subdirectories so that you can organize your files hierarchically in iCloud. However, you are responsible for creating those intermediate subdirectories (using the NSFileManagerMBS or folderitem class) in your iCloud container directory.
error: If an error occurs, this pointer is set to an NSError object containing information about the error. You may specify nil for this parameter if you do not want the error information.

Returns yes if the item's status was updated successfully or false if an error occurred. If this method returns false and you specified a value for the error parameter, this method returns an error object.

Use this method to move a file from its current location to iCloud. For files located in an application's sandbox, this involves physically removing the file from the sandbox directory. (The system extends your application's sandbox privileges to give it access to files it moves to iCloud.) You can also use this method to move files out of iCloud and back into a local directory.

Your application must have an active file presenter object configured to monitor the specified file or directory before calling this method. When you specify true for the flag parameter, this method attempts to move the file or directory to the cloud and returns true if it is successful. This method also notifies your file presenter of the new location of the file so that your application can continue to operate on it.

Important: Do not call this method from your application's main thread. This method performs a coordinated write operation on the file you specify, and calling this method from the main thread can trigger a deadlock with the file presenter you have monitoring the file. Instead, use a dispatch queue (other than the main thread queue) to perform the method call on a secondary thread. You can always message your main thread after the call finishes to update the rest of your application's data structures.

Available in Mac OS X v10.7 and later.

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.setUbiquitous(flag as boolean, item as folderitem, destURL as string, byref error as NSErrorMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 12.1 Yes No No Yes, macOS only No
Function: Sets whether the item at the specified URL should be stored in the cloud.
Notes:
flag: Specify true to move the item to iCloud or false to remove it from iCloud (if it is there currently).
item: Specify the folderitem of the item (file or directory) that you want to store in iCloud.
destitem: Specify the location in iCloud at which to store the file or directory. This folderitem must be constructed from a folderitem returned by the URLForUbiquityContainerIdentifier method, which you use to retrieve the desired iCloud container directory. The folderitem you specify may contain additional subdirectories so that you can organize your files hierarchically in iCloud. However, you are responsible for creating those intermediate subdirectories (using the NSFileManagerMBS or folderitem class) in your iCloud container directory.
error: If an error occurs, this pointer is set to an NSError object containing information about the error. You may specify nil for this parameter if you do not want the error information.

Returns yes if the item's status was updated successfully or false if an error occurred. If this method returns false and you specified a value for the error parameter, this method returns an error object.

Use this method to move a file from its current location to iCloud. For files located in an application's sandbox, this involves physically removing the file from the sandbox directory. (The system extends your application's sandbox privileges to give it access to files it moves to iCloud.) You can also use this method to move files out of iCloud and back into a local directory.

Your application must have an active file presenter object configured to monitor the specified file or directory before calling this method. When you specify true for the flag parameter, this method attempts to move the file or directory to the cloud and returns true if it is successful. This method also notifies your file presenter of the new location of the file so that your application can continue to operate on it.

Important: Do not call this method from your application's main thread. This method performs a coordinated write operation on the file you specify, and calling this method from the main thread can trigger a deadlock with the file presenter you have monitoring the file. Instead, use a dispatch queue (other than the main thread queue) to perform the method call on a secondary thread. You can always message your main thread after the call finishes to update the rest of your application's data structures.

Available in Mac OS X v10.7 and later.

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.startDownloadingUbiquitousItem(item as folderitem, byref error as NSErrorMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 11.3 Yes No No Yes, macOS only No
Function: Starts downloading (if necessary) the specified item to the local system.
Notes:
item: Specify the folderitem for the file or directory in the cloud that you want to download.
error: On input, a pointer to variable for an NSError object. If an error occurs, this pointer is set to an NSError object containing information about the error. Y

Returns true if the download started successfully or was not necessary, otherwise false. If false is returned and error is not nil, an NSError object describing the error is returned in that parameter.

If a cloud-based file or directory has not been downloaded yet, calling this method starts the download process. If the item exists locally, calling this method synchronizes the local copy with the version in the cloud.

For a given folderitem, you can determine if a file is downloaded by getting the value of the IsDownloaded method. You can also use related methods to determine the current progress in downloading the file.

Available in Mac OS X v10.7 and later.

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.startDownloadingUbiquitousItem(URL as string, byref error as NSErrorMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 12.1 Yes No No Yes, macOS only No
Function: Starts downloading (if necessary) the specified item to the local system.
Notes:
item: Specify the URL for the file or directory in the cloud that you want to download.
error: On input, a pointer to variable for an NSError object. If an error occurs, this pointer is set to an NSError object containing information about the error. Y

Returns true if the download started successfully or was not necessary, otherwise false. If false is returned and error is not nil, an NSError object describing the error is returned in that parameter.

If a cloud-based file or directory has not been downloaded yet, calling this method starts the download process. If the item exists locally, calling this method synchronizes the local copy with the version in the cloud.

For a given folderitem, you can determine if a file is downloaded by getting the value of the IsDownloaded method. You can also use related methods to determine the current progress in downloading the file.

Available in Mac OS X v10.7 and later.

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.stringByAbbreviatingWithTildeInPath(path as string) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 16.4 Yes No No Yes, macOS only No
Function: Returns a new string that replaces the current home directory portion of the current path with a tilde (~) character.
Notes:
A new string based on the current string object. If the new string specifies a file in the current home directory, the home directory portion of the path is replaced with a tilde (~) character. If the string does not specify a file in the current home directory, this method returns a new string object whose path is unchanged from the path in the current string.

Note that this method only works with file paths. It does not work for string representations of URLs.

For sandboxed apps in OS X, the current home directory is not the same as the user’s home directory. For a sandboxed app, the home directory is the app’s home directory. So if you specified a path of /Users/<current_user>/file.txt for a sandboxed app, the returned path would be unchanged from the original. However, if you specified the same path for an app not in a sandbox, this method would replace the /Users/<current_user> portion of the path with a tilde.

Feedback, Comments & Corrections

NSFileManagerMBS.stringByAppendingPathComponent(path as string, Component as string) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 16.4 Yes No No Yes, macOS only No
Function: Returns a new string made by appending to the receiver a given string.
Notes:
The following table illustrates the effect of this method on a variety of different paths, assuming that aString is supplied as “scratch.tiff”:

Receiver’s String ValueResulting String
“/tmp”“/tmp/scratch.tiff”
“/tmp/”“/tmp/scratch.tiff”
“/”“/scratch.tiff”
“” (an empty string)“scratch.tiff”

Note that this method only works with file paths (not, for example, string representations of URLs).

Feedback, Comments & Corrections

NSFileManagerMBS.stringByAppendingPathExtension(path as string, Extension as string) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 16.4 Yes No No Yes, macOS only No
Function: Returns a new string made by appending to the receiver an extension separator followed by a given extension.
Notes:
The following table illustrates the effect of this method on a variety of different paths, assuming that ext is supplied as "tiff":

Receiver’s String ValueResulting String
“/tmp/scratch.old”“/tmp/scratch.old.tiff”
“/tmp/scratch.”“/tmp/scratch..tiff”
“/tmp/”“/tmp.tiff”
“scratch”“scratch.tiff”

Note that adding an extension to "/tmp/" causes the result to be "/tmp.tiff" instead of "/tmp/.tiff". This difference is because a file named ".tiff" is not considered to have an extension, so the string is appended to the last nonempty path component.

Note that this method only works with file paths (not, for example, string representations of URLs).

Special Considerations
Prior to OS X v10.9 this method did not allow you to append file extensions to filenames starting with the tilde character (~).

Feedback, Comments & Corrections

NSFileManagerMBS.stringByDeletingLastPathComponent(path as string) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 16.4 Yes No No Yes, macOS only No
Function: Returns a new string made by deleting the last path component from the receiver, along with any final path separator.
Notes:
A new string made by deleting the last path component from the receiver, along with any final path separator. If the receiver represents the root path it is returned unaltered.

The following table illustrates the effect of this method on a variety of different paths:

Receiver’s String ValueResulting String
“/tmp/scratch.tiff”“/tmp”
“/tmp/lock/”“/tmp”
“/tmp/”“/”
“/tmp”“/”
“/”“/”
“scratch.tiff”“” (an empty string)

Note that this method only works with file paths (not, for example, string representations of URLs).

Feedback, Comments & Corrections

NSFileManagerMBS.stringByDeletingPathExtension(path as string) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 16.4 Yes No No Yes, macOS only No
Function: Returns a new string made by deleting the extension (if any, and only the last) from the receiver.
Notes:
A new string made by deleting the extension (if any, and only the last) from the receiver. Strips any trailing path separator before checking for an extension. If the receiver represents the root path, it is returned unaltered.

The following table illustrates the effect of this method on a variety of different paths:

Receiver’s String ValueResulting String
“/tmp/scratch.tiff”“/tmp/scratch”
“/tmp/”“/tmp”
“scratch.bundle/”“scratch”
“scratch..tiff”“scratch.”
“.tiff”“.tiff”
“/”“/”

Note that attempting to delete an extension from ".tiff" causes the result to be @".tiff" instead of an empty string. This difference is because a file named ".tiff" is not considered to have an extension, so nothing is deleted. Note also that this method only works with file paths (not, for example, string representations of URLs).

Feedback, Comments & Corrections

NSFileManagerMBS.stringByExpandingTildeInPath(path as string) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 16.4 Yes No No Yes, macOS only No
Function: Returns a new string made by expanding the initial component of the receiver to its full path value.
Notes:
A new string made by expanding the initial component of the receiver, if it begins with “~” or “~user”, to its full path value. Returns a new string matching the receiver if the receiver’s initial component can’t be expanded.

Note that this method only works with file paths (not, for example, string representations of URLs).

Feedback, Comments & Corrections

NSFileManagerMBS.stringByResolvingSymlinksInPath(path as string) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 16.4 Yes No No Yes, macOS only No
Function: Returns a new string made from the receiver by resolving all symbolic links and standardizing path.
Notes:
A new string made by resolving all symbolic links, then removing extraneous path components. For absolute paths, all symbolic links are guaranteed to be removed. For relative paths, symbolic links that can’t be resolved are left unresolved in the returned string.

Returns self if an error occurs.

Note that this method only works with file paths (not, for example, string representations of URLs).

Feedback, Comments & Corrections

NSFileManagerMBS.stringByStandardizingPath(path as string) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 16.4 Yes No No Yes, macOS only No
Function: Returns a new string made by removing extraneous path components from the receiver.
Notes:
A new string made by performing the following operations:

  • Expanding an initial tilde expression using stringByExpandingTildeInPath.
  • Removing an initial component of “/private/var/automount”, “/var/automount”, or “/private” from the path, if the result still indicates an existing file or directory (checked by consulting the file system).
  • Reducing empty components and references to the current directory (that is, the sequences “//” and “/./”) to single path separators.
  • Removing a trailing slash from the last component.
  • For absolute paths only, resolving references to the parent directory (that is, the component “..”) to the real parent directory if possible using stringByResolvingSymlinksInPath. For relative paths, references to the parent directory are left in place.
  • Returns self if an error occurs.

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

Feedback, Comments & Corrections

NSFileManagerMBS.trashItem(file as folderItem, byref Resulting as folderItem, byref error as NSErrorMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 13.4 Yes No No Yes, macOS only No
Function: Moves an item to the trash.
Notes:
Returns true if the item at url was successfully moved to the trash. Since the operation may require renaming the item to avoid a file name collision, this method returns, by reference, the resulting folderitem that the item was moved to.

If this method returns false, the item was not moved to the trash; the error parameter then contains information about the error.

Available in OS X v10.8 and later.

Feedback, Comments & Corrections

NSFileManagerMBS.URLByAppendingPathComponent(URL as string, pathComponent as string) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 12.1 Yes No No Yes, macOS only No
Function: Returns a new URL made by appending a path component to the original URL.
Notes:
pathComponent: The path component to add to the URL.

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

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.URLByAppendingPathComponent(URL as string, pathComponent as string, isDirectory as boolean) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 12.1 Yes No No Yes, macOS only No
Function: 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.
Notes:
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 Mac OS X v10.7 and later.

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.URLByAppendingPathExtension(URL as string, pathExtension as string) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 12.1 Yes No No Yes, macOS only No
Function: Returns a new URL made by appending a path extension to the original URL.
Notes:
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 Mac OS X v10.6 and later.

Feedback, Comments & Corrections

NSFileManagerMBS.URLByDeletingLastPathComponent(URL as string) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 12.1 Yes No No Yes, macOS only No
Function: Returns a new URL made by deleting the last path component from the original URL.
Notes:
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.
Available in Mac OS X v10.6 and later.

Feedback, Comments & Corrections

NSFileManagerMBS.URLByDeletingPathExtension(URL as string) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 12.1 Yes No No Yes, macOS only No
Function: Returns a new URL made by deleting the path extension, if any, from the original URL.
Notes:
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.
Available in Mac OS X v10.6 and later.

Feedback, Comments & Corrections

NSFileManagerMBS.URLByResolvingSymlinksInPath(URL as string) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 12.1 Yes No No Yes, macOS only No
Function: Returns a new URL that points to the same resource as the original URL and includes no symbolic links.
Notes:
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.

Available in Mac OS X v10.6 and later.

Feedback, Comments & Corrections

NSFileManagerMBS.URLByStandardizingPath(URL as string) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 12.1 Yes No No Yes, macOS only No
Function: Returns a new URL that points to the same resource as the original URL and is an absolute path.
Notes:
This method only works on URLs with the file: path scheme. This method will return an identical URL for all other URLs.

Available in Mac OS X v10.6 and later.

Feedback, Comments & Corrections

NSFileManagerMBS.URLForPublishingUbiquitousItem(item as folderitem, byref expirationDate as date, byref error as NSErrorMBS) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 11.3 Yes No No Yes, macOS only No
Function: Returns a URL that can be emailed to users to allow them to download a copy of a cloud-based item.
Example:
dim m as new NSFileManagerMBS
dim f as FolderItem = SpecialFolder.Desktop.Child("test.rtf")

dim error as NSErrorMBS
dim exdate as date
dim url as string = m.URLForPublishingUbiquitousItem(f, exdate, error)

// always fails as desktop folder is not in cloud
if error<>nil then
MsgBox error.localizedDescription
end if
Notes:
url: Specify the URL of the item in the cloud that you want to share. The URL must be prefixed with the base URL returned from the URLForUbiquityContainerIdentifier method that corresponds to the item's location.
expirationDate: On output, this parameter contains the date after which the item is no longer available at the returned URL.
error: If an error occurs, this pointer is set to an NSError object containing information about the error.

Returns an URL with which users can download a copy of the item at url. Returns nil if the URL could not be created for any reason.

Discussion
This method creates a snapshot of the specified file and places that copy in a temporary iCloud location where it can be accessed by other users using the returned URL. The snapshot reflects the contents of the file at the time the URL was generated and is not updated when subsequent changes are made to the original file in the user's iCloud storage. The snapshot file remains available at the specified URL until the date specified in the outDate parameter, after which it is automatically deleted.

Your application must have access to the network for this call to succeed.
Available in Mac OS X v10.7 and later.

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.URLForPublishingUbiquitousItem(URL as string, byref expirationDate as date, byref error as NSErrorMBS) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 12.1 Yes No No Yes, macOS only No
Function: Returns a URL that can be emailed to users to allow them to download a copy of a cloud-based item.
Notes:
url: Specify the URL of the item in the cloud that you want to share. The URL must be prefixed with the base URL returned from the URLForUbiquityContainerIdentifier method that corresponds to the item's location.
expirationDate: On output, this parameter contains the date after which the item is no longer available at the returned URL.
error: If an error occurs, this pointer is set to an NSError object containing information about the error.

Returns an URL with which users can download a copy of the item at url. Returns nil if the URL could not be created for any reason.

Discussion
This method creates a snapshot of the specified file and places that copy in a temporary iCloud location where it can be accessed by other users using the returned URL. The snapshot reflects the contents of the file at the time the URL was generated and is not updated when subsequent changes are made to the original file in the user's iCloud storage. The snapshot file remains available at the specified URL until the date specified in the outDate parameter, after which it is automatically deleted.

Your application must have access to the network for this call to succeed.
Available in Mac OS X v10.7 and later.

See also:

Feedback, Comments & Corrections

NSFileManagerMBS.URLForUbiquityContainerIdentifier(containerIdentifier as string) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
shared method iCloud MBS MacCloud Plugin 12.1 Yes No No Yes, macOS only No
Function: Returns the iCloud directory associated with the specified container ID.
Notes:
containerID: Specify the container ID of the cloud-based storage container. The string you specify must not contain wildcards and must be of the form <TEAMID>.<CONTAINER>, where <TEAMID> is your development team ID and <CONTAINER> describes the bundle identifier of the container you want to access. The container identifiers for your application must be declared in the com.apple.developer.ubiquity-container-identifiers entitlement.
If you specify "", this method returns the first container listed in the com.apple.developer.ubiquity-container-identifiers entitlement.

Returns a folderitem pointing to the specified container directory or nil if the container could not be located or if iCloud storage is unavailable for the current user or device.

You can use the folderitem returned by this method to build paths to files and directories in the user's iCloud storage. Each application that syncs documents to the cloud must have at least one associated container directory in which to put those files. This container directory can be unique to the application or shared by multiple applications. You use this method to retrieve the folderitem for that container directory.

In addition to writing to its own container directory, an application can write to any container directory for which it has the appropriate permission. Each additional container directory should be listed as an additional value in the com.apple.developer.ubiquity-container-identifiers entitlement.

Note: The development team ID that precedes each container ID string is the unique identifier associated with your development team. You can find this string in the Member Center of the Apple Developer website (http://developer.apple.com/membercenter). From the Member Center home page, select the Your Account tab and then select Organization Profile from the column on the left of that tab. Your team's identifier is in the Company/Organization ID field.
The first time you call this method for a given container directory, iOS extends your application sandbox to include that container directory. Thus, it is important that you call this method at least once before trying to search for files in iCloud. And if your application accesses multiple container directories, you should call the method once for each directory.

Available in Mac OS X v10.7 and later.
FileForUbiquityContainerIdentifier returns folderitem while URLForUbiquityContainerIdentifier returns URL string.

Feedback, Comments & Corrections

Previous items

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




Links
MBS Xojo PDF Plugins