Instance Method

accountStatus(completionHandler:)

Reports whether the current user’s iCloud account can be accessed.

Declaration

func accountStatus(completionHandler: @escaping (CKAccountStatus, Error?) -> Void)

Parameters

completionHandler

A block that has no return value and takes the following parameters:

accountStatus

The status of the current user’s iCloud account.

error

An error object, or nil if the status is determined successfully. Use the information in the error object to determine whether the problem has a workaround.

Discussion

This method determines the status of the current user’s iCloud account asynchronously, reporting the results to the block in the completionHandler parameter. Call this method before accessing the private database to determine whether that database is available. While your app is running, use the CKAccountChanged notification to detect account changes and call this method again to retrieve the status for the new account.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software