Instance Method

startDownloadingUbiquitousItem(at:)

Starts downloading (if necessary) the specified item to the local system.

Declaration

func startDownloadingUbiquitousItem(at url: URL) throws

Parameters

url

Specify the URL for the file or directory in the cloud that you want to download.

Return Value

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

Discussion

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 URL, you can determine if a file is downloaded by getting the value of the NSMetadataUbiquitousItemDownloadingStatusKey key. You can also use related keys to determine the current progress in downloading the file.

See Also

Managing iCloud-Based Items

var ubiquityIdentityToken: (NSCoding & NSCopying & NSObjectProtocol)?

An opaque token that represents the current user’s iCloud identity.

func url(forUbiquityContainerIdentifier: String?)

Returns the URL for the iCloud container associated with the specified identifier and establishes access to that container.

func isUbiquitousItem(at: URL)

Returns a Boolean indicating whether the item is targeted for storage in iCloud.

func setUbiquitous(Bool, itemAt: URL, destinationURL: URL)

Sets whether the item at the specified URL should be stored in the cloud.

func evictUbiquitousItem(at: URL)

Removes the local copy of the specified cloud-based item.

func url(forPublishingUbiquitousItemAt: URL, expiration: AutoreleasingUnsafeMutablePointer<NSDate?>?)

Returns a URL that can be emailed to users to allow them to download a copy of a cloud-based flat file item.