One Logo Pool Ball
CloudKit · IOS API REFERENCE

CKContainer

class · iOS 8.0+ · SDK 27.1

class CKContainer

Members (54)

init · iOS 8.0+

init

TypeScript
static init(containerIdentifier: string): CKContainer
Swift declaration
init(identifier containerIdentifier: String)
static · iOS 8.0+

default

TypeScript
static default(): CKContainer
Swift declaration
class func `default`() -> CKContainer
method · iOS 10.0+

accept

TypeScript
acceptCompletionHandler(metadata: CKShare_Metadata, completionHandler: ((arg0: (CKShare) | null, arg1: (NativeError) | null) => void)): void
Swift declaration
func accept(_ metadata: CKShare.Metadata, completionHandler: @escaping @Sendable (CKShare?, (any Error)?) -> Void)
method

accountStatus

TypeScript
accountStatus(completionHandler: ((arg0: CKAccountStatus, arg1: (NativeError) | null) => void)): void
Swift declaration
func accountStatus() async throws -> CKAccountStatus
method · iOS 8.0+

add

TypeScript
add(operation: CKOperation): void
Swift declaration
func add(_ operation: CKOperation)
method · iOS 10.0+

database

TypeScript
database(databaseScope: CKDatabase_Scope): CKDatabase
Swift declaration
func database(with databaseScope: CKDatabase.Scope) -> CKDatabase
method · iOS 10.0+ · Deprecated in iOS 17.0

discoverAllIdentities

TypeScript
discoverAllIdentities(completionHandler: ((arg0: (Array<CKUserIdentity>) | null, arg1: (NativeError) | null) => void)): void
Swift declaration
func discoverAllIdentities(completionHandler: @escaping @Sendable ([CKUserIdentity]?, (any Error)?) -> Void)
method · iOS 10.0+ · Deprecated in iOS 17.0

discoverUserIdentity

TypeScript
discoverUserIdentityWithEmailAddressCompletionHandler(email: string, completionHandler: ((arg0: (CKUserIdentity) | null, arg1: (NativeError) | null) => void)): void
Swift declaration
func discoverUserIdentity(withEmailAddress email: String, completionHandler: @escaping @Sendable (CKUserIdentity?, (any Error)?) -> Void)
method · iOS 10.0+ · Deprecated in iOS 17.0

discoverUserIdentity

TypeScript
discoverUserIdentityWithPhoneNumberCompletionHandler(phoneNumber: string, completionHandler: ((arg0: (CKUserIdentity) | null, arg1: (NativeError) | null) => void)): void
Swift declaration
func discoverUserIdentity(withPhoneNumber phoneNumber: String, completionHandler: @escaping @Sendable (CKUserIdentity?, (any Error)?) -> Void)
method · iOS 10.0+ · Deprecated in iOS 17.0

discoverUserIdentity

TypeScript
discoverUserIdentityWithUserRecordIDCompletionHandler(userRecordID: CKRecord_ID, completionHandler: ((arg0: (CKUserIdentity) | null, arg1: (NativeError) | null) => void)): void
Swift declaration
func discoverUserIdentity(withUserRecordID userRecordID: CKRecord.ID, completionHandler: @escaping @Sendable (CKUserIdentity?, (any Error)?) -> Void)
method · iOS 10.0+

fetchShareMetadata

TypeScript
fetchShareMetadata(url: string, completionHandler: ((arg0: (CKShare_Metadata) | null, arg1: (NativeError) | null) => void)): void
Swift declaration
func fetchShareMetadata(with url: URL, completionHandler: @escaping @Sendable (CKShare.Metadata?, (any Error)?) -> Void)
method · iOS 10.0+

fetchShareParticipant

TypeScript
fetchShareParticipantWithEmailAddressCompletionHandler(emailAddress: string, completionHandler: ((arg0: (CKShare_Participant) | null, arg1: (NativeError) | null) => void)): void
Swift declaration
func fetchShareParticipant(withEmailAddress emailAddress: String, completionHandler: @escaping @Sendable (CKShare.Participant?, (any Error)?) -> Void)
method · iOS 10.0+

fetchShareParticipant

TypeScript
fetchShareParticipantWithPhoneNumberCompletionHandler(phoneNumber: string, completionHandler: ((arg0: (CKShare_Participant) | null, arg1: (NativeError) | null) => void)): void
Swift declaration
func fetchShareParticipant(withPhoneNumber phoneNumber: String, completionHandler: @escaping @Sendable (CKShare.Participant?, (any Error)?) -> Void)
method · iOS 10.0+

fetchShareParticipant

TypeScript
fetchShareParticipantWithUserRecordIDCompletionHandler(userRecordID: CKRecord_ID, completionHandler: ((arg0: (CKShare_Participant) | null, arg1: (NativeError) | null) => void)): void
Swift declaration
func fetchShareParticipant(withUserRecordID userRecordID: CKRecord.ID, completionHandler: @escaping @Sendable (CKShare.Participant?, (any Error)?) -> Void)
method

fetchUserRecordID

TypeScript
fetchUserRecordID(completionHandler: ((arg0: (CKRecord_ID) | null, arg1: (NativeError) | null) => void)): void
Swift declaration
func userRecordID() async throws -> CKRecord.ID
method · iOS 8.0+ · Deprecated in iOS 17.0

requestApplicationPermission

TypeScript
requestApplicationPermission(applicationPermission: CKContainer_ApplicationPermissions, completionHandler: ((arg0: CKContainer_ApplicationPermissionStatus, arg1: (NativeError) | null) => void)): void
Swift declaration
func requestApplicationPermission(_ applicationPermission: CKContainer.ApplicationPermissions) async throws -> CKContainer.ApplicationPermissionStatus
method · iOS 8.0+ · Deprecated in iOS 17.0

status

TypeScript
status(applicationPermission: CKContainer_ApplicationPermissions, completionHandler: ((arg0: CKContainer_ApplicationPermissionStatus, arg1: (NativeError) | null) => void)): void
Swift declaration
func applicationPermissionStatus(for applicationPermission: CKContainer.ApplicationPermissions) async throws -> CKContainer.ApplicationPermissionStatus
get · iOS 8.0+

containerIdentifier

TypeScript
get containerIdentifier(): (string) | null
Swift declaration
var containerIdentifier: String? { get }
get

privateCloudDatabase

TypeScript
get privateCloudDatabase(): CKDatabase
Swift declaration
var privateCloudDatabase: CKDatabase { get }
get

publicCloudDatabase

TypeScript
get publicCloudDatabase(): CKDatabase
Swift declaration
var publicCloudDatabase: CKDatabase { get }
get · iOS 10.0+

sharedCloudDatabase

TypeScript
get sharedCloudDatabase(): CKDatabase
Swift declaration
var sharedCloudDatabase: CKDatabase { get }
method · iOS 15.0+ · Deprecated in iOS 17.0

userIdentity

TypeScript
userIdentityForPhoneNumber(phoneNumber: string): Promise<(CKUserIdentity) | null>
Swift declaration
func userIdentity(forPhoneNumber phoneNumber: String) async throws -> CKUserIdentity?

Fetches the user identity for the specified phone number. - Parameters: - phoneNumber: The user's phone number. - Returns: The user identity for the phone number. Use this method to retrieve the identity of a user who the current user knows. The user you're searching for must meet the following criteria: - The user has run the app. - The user grants the ``CKContainer/ApplicationPermissions/userDiscoverability`` permission for the container. This method searches for the user asynchronously and with a low priority. If you want the task to execute the request with a higher priority, create an instance of ``CKDiscoverUserIdentitiesOperation`` and configure it to use the necessary priority.

method · iOS 15.0+ · Deprecated in iOS 17.0

userIdentity

TypeScript
userIdentityForEmailAddress(email: string): Promise<(CKUserIdentity) | null>
Swift declaration
func userIdentity(forEmailAddress email: String) async throws -> CKUserIdentity?

Fetches the user identity for the specified email address. - Parameters: - email: The user's email address. - Returns: The user identity for the email address. Use this method to retrieve the identity of a user who the current user knows. The user you're searching for must meet the following criteria: - The user has run the app. - The user grants the ``CKContainer/ApplicationPermissions/userDiscoverability`` permission for the container. This method searches for the user asynchronously and with a low priority. If you want the task to execute the request with a higher priority, create an instance of ``CKDiscoverUserIdentitiesOperation`` and configure it to use the necessary priority.

method · iOS 15.0+ · Deprecated in iOS 17.0

userIdentity

TypeScript
userIdentityForUserRecordID(userRecordID: CKRecord_ID): Promise<(CKUserIdentity) | null>
Swift declaration
func userIdentity(forUserRecordID userRecordID: CKRecord.ID) async throws -> CKUserIdentity?

Fetches the user identity for the specified user record ID. - Parameters: - userRecordID: The user record's ID. - Returns: The user identity for the user record ID. Use this method to retrieve the identity of a user who you already have a user record ID for. The user you're searching for must meet the following criteria: - The user has run the app. - The user grants the ``CKContainer/ApplicationPermissions/userDiscoverability`` permission for the container. This method searches for the user asynchronously and with a low priority. If you want the task to execute the request with a higher priority, create an instance of ``CKDiscoverUserIdentitiesOperation`` and configure it to use the necessary priority.

method · iOS 15.0+

shareMetadata

TypeScript
shareMetadata(url: string): Promise<CKShare_Metadata>
Swift declaration
func shareMetadata(for url: URL) async throws -> CKShare.Metadata

Fetches the share metadata for the specified share URL. - Parameters: - url: The share URL that CloudKit uses to locate the metadata. - Returns: The share metadata for the share URL.

method · iOS 15.0+

configuredWith

TypeScript
configuredWithConfigurationGroupBody(configuration: (CKOperation_Configuration) | null, group: (CKOperationGroup) | null, body: ((arg0: CKContainer) => unknown)): unknown
Swift declaration
@discardableResult func configuredWith<R>(configuration: CKOperation.Configuration? = nil, group: CKOperationGroup? = nil, body: (CKContainer) throws -> R) rethrows -> R

Applies a temporary configuration to the container within the scope of a closure. - Parameters: - configuration: An interim configuration to apply to the current container. - group: The group to associate with the methods you execute in the closure. Specifying a group helps the system prioritize those method calls, and helps you identify the calls in the server logs in CloudKit Console. For more information, see ``CKOperationGroup``. - body: The closure to execute with the temporarily configured container. Use this method to apply a specific configuration to the current container that lasts only for the duration of the trailing closure. For example, you might want to temporarily elevate the quality of service (QoS) for a group of method calls, or allow one or more expensive method calls to execute only while the device is using WiFi. ```swift func fetchShareParticipants( with phoneNumbers: [String], completionHandler: @escaping ( Result<[String : Result<CKShare.Participant, any Error>], any Error> ) -> Void ) { // Get a reference to the app's container. let container = CKContainer.default() // Create a configuration that denies cellular access. let config = CKOperation.Configuration() config.allowsCellularAccess = false // Configure the container and execute an expensive fetch. container.configuredWith(configuration: config) { container in container.fetchShareParticipants(forPhoneNumbers: phoneNumbers, completionHandler: completionHandler) } } ```

method · iOS 15.0+

configuredWith

TypeScript
configuredWithConfigurationGroupBody21466(configuration: (CKOperation_Configuration) | null, group: (CKOperationGroup) | null, body: ((arg0: CKContainer) => Promise<unknown>)): Promise<unknown>
Swift declaration
@discardableResult @preconcurrency func configuredWith<R>(configuration: CKOperation.Configuration? = nil, group: CKOperationGroup? = nil, body: @Sendable (CKContainer) async throws -> R) async rethrows -> R

Applies a temporary configuration to the container within the scope of a closure that supports concurrency. - Parameters: - configuration: An interim configuration to apply to the current container. - group: The group to associate with the methods you execute in the closure. Specifying a group helps the system prioritize those method calls, and helps you identify the calls in the server logs in CloudKit Console. For more information, see ``CKOperationGroup``. - body: The closure to execute with the temporarily configured container. Use this method to apply a specific configuration to the current container that lasts only for the duration of the trailing closure. For example, you might want to temporarily elevate the quality of service (QoS) for a group of method calls, or allow one or more expensive method calls to execute only while the device is using WiFi. ```swift func fetchShareParticipants( with phoneNumbers: [String] ) async throws -> [String : Result<CKShare.Participant, any Error>] { // Get a reference to the app's container. let container = CKContainer.default() // Create a configuration that denies cellular access. let config = CKOperation.Configuration() config.allowsCellularAccess = false // Configure the container and execute an expensive fetch. return try await container.configuredWith(configuration: config) { container in try await container.shareParticipants(forPhoneNumbers: phoneNumbers) } } ```

method · iOS 15.0+

shareMetadatas

TypeScript
shareMetadatas(urls: Array<string>): Promise<Record<string, SDKHandle>>
Swift declaration
func shareMetadatas(for urls: [URL]) async throws -> [URL : Result<CKShare.Metadata, any Error>]

Fetches share metadatas for the specified share URLs and returns them to an awaiting caller. - Parameters: - urls: The share URLs that CloudKit uses to locate the metadatas. - Returns: A dictionary of fetched share metadatas. The dictionary uses the URLs you specify in `urls` as its keys. The value of each key is a <doc://com.apple.documentation/documentation/swift/result> that contains either the corresponding fetched share metadata, or an error that describes why CloudKit can't fetch that share metadata. This method searches for share metadatas asynchronously and with a low priority. If you want the task to execute with a higher priority, create an instance of ``CKFetchShareMetadataOperation`` and configure it to use the necessary priority.

method · iOS 15.0+ · Deprecated in iOS 17.0

userIdentities

TypeScript
userIdentitiesForPhoneNumbers(phoneNumbers: Array<string>): Promise<Record<string, CKUserIdentity>>
Swift declaration
func userIdentities(forPhoneNumbers phoneNumbers: [String]) async throws -> [String : CKUserIdentity]

Fetches the user identities for the specified phone numbers and returns them to an awaiting caller. - Parameters: - phoneNumbers: The users' phone numbers. - Returns: A <doc://com.apple.documentation/documentation/swift/result> that contains either a dictionary of user identities, or an error that describes why CloudKit can't discover the phone numbers. In the successful case, the dictionary uses the phone numbers you specify in `phoneNumbers` as its keys. Only successfully discovered user identities are present in this dictionary. Use this method to retrieve the identities of users who the current user knows. The users you're searching for must meet the following criteria: - The user has run the app. - The user grants the ``CKContainer/ApplicationPermissions/userDiscoverability`` permission for the container. This method searches for users asynchronously and with a low priority. If you want the task to execute the request with a higher priority, create an instance of ``CKDiscoverUserIdentitiesOperation`` and configure it to use the necessary priority.

method · iOS 15.0+ · Deprecated in iOS 17.0

userIdentities

TypeScript
userIdentitiesForUserRecordIDs(userRecordIDs: Array<CKRecord_ID>): Promise<NativeMap<CKRecord_ID, CKUserIdentity>>
Swift declaration
func userIdentities(forUserRecordIDs userRecordIDs: [CKRecord.ID]) async throws -> [CKRecord.ID : CKUserIdentity]

Fetches the user identities for the specified user record IDs and returns them to an awaiting caller. - Parameters: - userRecordIDs: The users' user record IDs. - Returns: A <doc://com.apple.documentation/documentation/swift/result> that contains either a dictionary of user identities, or an error that describes why CloudKit can't discover the user record IDs. In the successful case, the dictionary uses the user record IDs you specify in `userRecordIDs` as its keys. Only successfully discovered user identities are present in this dictionary. Use this method to retrieve the identities of users who the current user knows. The users you're searching for must meet the following criteria: - The user has run the app. - The user grants the ``CKContainer/ApplicationPermissions/userDiscoverability`` permission for the container. This method searches for users asynchronously and with a low priority. If you want the task to execute the request with a higher priority, create an instance of ``CKDiscoverUserIdentitiesOperation`` and configure it to use the necessary priority.

method · iOS 15.0+ · Deprecated in iOS 17.0

userIdentities

TypeScript
userIdentitiesForEmailAddresses(emails: Array<string>): Promise<Record<string, CKUserIdentity>>
Swift declaration
func userIdentities(forEmailAddresses emails: [String]) async throws -> [String : CKUserIdentity]

Fetches the user identities for the specified email addresses and returns them to an awaiting caller. - Parameters: - emails: The users' email addresses. - Returns: A <doc://com.apple.documentation/documentation/swift/result> that contains either a dictionary of user identities, or an error that describes why CloudKit can't discover the email addresses. In the successful case, the dictionary uses the email addresses you specify in `emails` as its keys. Only successfully discovered user identities are present in this dictionary. Use this method to retrieve the identities of users who the current user knows. The users you're searching for must meet the following criteria: - The user has run the app. - The user grants the ``CKContainer/ApplicationPermissions/userDiscoverability`` permission for the container. This method searches for users asynchronously and with a low priority. If you want the task to execute the request with a higher priority, create an instance of ``CKDiscoverUserIdentitiesOperation`` and configure it to use the necessary priority.

method · iOS 15.0+

shareParticipant

TypeScript
shareParticipantForPhoneNumber(phoneNumber: string): Promise<CKShare_Participant>
Swift declaration
func shareParticipant(forPhoneNumber phoneNumber: String) async throws -> CKShare.Participant

Fetches the share participant with the specified phone number. - Parameters: - phoneNumber: The share participant's phone number. - Returns: The share participant for the phone number. CloudKit can translate any valid phone number into a share participant. If the phone number doesn't correspond to a known iCloud account, then at share-accept-time, CloudKit offers the accepting participant a vetting process. The accepting participant uses this vetting process to link the phone number to an iCloud account. This method searches for the share participant asynchronously and with a low priority. If you want the task to execute with a higher priority, create an instance of ``CKFetchShareParticipantsOperation`` and configure it to use the necessary priority.

method · iOS 15.0+

shareParticipant

TypeScript
shareParticipantForEmailAddress(email: string): Promise<CKShare_Participant>
Swift declaration
func shareParticipant(forEmailAddress email: String) async throws -> CKShare.Participant

Fetches the share participant with the specified email address. - Parameters: - emailAddress: The share participant's email address. - Returns: The share participant for the email address. CloudKit can translate any valid email address into a share participant. If the email address doesn't correspond to a known iCloud account, then at share-accept-time, CloudKit offers the accepting participant a vetting process. The accepting participant uses this vetting process to link the email address to an iCloud account. This method searches for the share participant asynchronously and with a low priority. If you want the task to execute with a higher priority, create an instance of ``CKFetchShareParticipantsOperation`` and configure it to use the necessary priority.

method · iOS 15.0+

shareParticipant

TypeScript
shareParticipantForUserRecordID(userRecordID: CKRecord_ID): Promise<CKShare_Participant>
Swift declaration
func shareParticipant(forUserRecordID userRecordID: CKRecord.ID) async throws -> CKShare.Participant

Fetches the share participant with the specified user record ID. - Parameters: - userRecordID: The share participant's user record ID. - Returns: The share participant for the user record ID. This method searches for the share participant asynchronously and with a low priority. If you want the task to execute with a higher priority, create an instance of ``CKFetchShareParticipantsOperation`` and configure it to use the necessary priority.

method · iOS 15.0+

shareParticipants

TypeScript
shareParticipantsForPhoneNumbers(phoneNumbers: Array<string>): Promise<Record<string, SDKHandle>>
Swift declaration
func shareParticipants(forPhoneNumbers phoneNumbers: [String]) async throws -> [String : Result<CKShare.Participant, any Error>]

Fetches share participants with the specified phone numbers and returns them to an awaiting caller. - Parameters: - phoneNumbers: The share participants' phone numbers. - Returns: A dictionary of fetched share participants. The dictionary uses the phone numbers you specify in `phoneNumbers` as its keys. The value of each key is a <doc://com.apple.documentation/documentation/swift/result> that contains either the corresponding fetched share participant, or an error that describes why CloudKit can't fetch that share participant. CloudKit can translate any valid phone number into a share participant. If the phone number doesn't correspond to a known iCloud account, then at share-accept-time, CloudKit offers the accepting participant a vetting process. The accepting participant uses this vetting process to link the phone number to an iCloud account. This method searches for share participants asynchronously and with a low priority. If you want the task to execute with a higher priority, create an instance of ``CKFetchShareParticipantsOperation`` and configure it to use the necessary priority.

method · iOS 15.0+

shareParticipants

TypeScript
shareParticipantsForUserRecordIDs(userRecordIDs: Array<CKRecord_ID>): Promise<NativeMap<CKRecord_ID, SDKHandle>>
Swift declaration
func shareParticipants(forUserRecordIDs userRecordIDs: [CKRecord.ID]) async throws -> [CKRecord.ID : Result<CKShare.Participant, any Error>]

Fetches share participants with the specified user record IDs and returns them to an awaiting caller. - Parameters: - userRecordIDs: The share participants' user record IDs. - Returns: A dictionary of fetched share participants. The dictionary uses the user record IDs you specify in `userRecordIDs` as its keys. The value of each key is a <doc://com.apple.documentation/documentation/swift/result> that contains either the corresponding fetched share participant, or an error that describes why CloudKit can't fetch that share participant. This method searches for share participants asynchronously and with a low priority. If you want the task to execute with a higher priority, create an instance of ``CKFetchShareParticipantsOperation`` and configure it to use the necessary priority.

method · iOS 15.0+

shareParticipants

TypeScript
shareParticipantsForEmailAddresses(emails: Array<string>): Promise<Record<string, SDKHandle>>
Swift declaration
func shareParticipants(forEmailAddresses emails: [String]) async throws -> [String : Result<CKShare.Participant, any Error>]

Fetches share participants with the specified email addresses and returns them to an awaiting caller. - Parameters: - emails: The share participants' email addresses. - Returns: A dictionary of fetched share participants. The dictionary uses the email addresses you specify in `emails` as its keys. The value of each key is a <doc://com.apple.documentation/documentation/swift/result> that contains either the corresponding fetched share participant, or an error that describes why CloudKit can't fetch that share participant. CloudKit can translate any valid email address into a share participant. If the email address doesn't correspond to a known iCloud account, then at share-accept-time, CloudKit offers the accepting participant a vetting process. The accepting participant uses this vetting process to link the email address to an iCloud account. This method searches for share participants asynchronously and with a low priority. If you want the task to execute with a higher priority, create an instance of ``CKFetchShareParticipantsOperation`` and configure it to use the necessary priority.

method · iOS 26.0+

shareParticipants

TypeScript
shareParticipantsFor(lookupInfos: Array<CKUserIdentity_LookupInfo>): Promise<NativeMap<CKUserIdentity_LookupInfo, SDKHandle>>
Swift declaration
func shareParticipants(for lookupInfos: [CKUserIdentity.LookupInfo]) async throws -> [CKUserIdentity.LookupInfo : Result<CKShare.Participant, any Error>]

Fetches share participants with the specified lookup infos and returns them to an awaiting caller. - Parameters: - lookupInfos: The share participants' lookup infos. - Returns: A dictionary of fetched share participants. The dictionary uses the lookup infos you specify in `lookupInfos` as its keys. The value of each key is a <doc://com.apple.documentation/documentation/swift/result> that contains either the corresponding fetched share participant, or an error that describes why CloudKit can't fetch that share participant. This method searches for share participants asynchronously and with a low priority. If you want the task to execute with a higher priority, create an instance of ``CKFetchShareParticipantsOperation`` and configure it to use the necessary priority.

method · iOS 15.0+

longLivedOperation

TypeScript
longLivedOperation(operationID: string): Promise<(CKOperation) | null>
Swift declaration
func longLivedOperation(for operationID: CKOperation.ID) async throws -> CKOperation?

Fetches the long-lived operation for the specified operation ID and returns it to an awaiting caller. - Parameters: - operationID: The operation's ID. - Returns: The long-lived operation, or `nil` if the operation completes, or your app or the system cancels it A long-lived operation is one that continues to run after the user closes your app. When a long-lived operation completes, the system calls its completion block to notify you. After setting callback blocks on the returned long-lived operation, and starting the returned long-lived operation on an operation queue, the operation invokes all callbacks made while your app was closed.

method · iOS 26.0+

requestShareAccess

TypeScript
requestShareAccess(urls: Array<string>): Promise<Record<string, SDKHandle>>
Swift declaration
func requestShareAccess(for urls: [URL]) async throws -> [URL : Result<Void, any Error>]

Requests access to the specified share URLs, and returns the results to an awaiting caller. - Parameters: - urls: The share URLs that CloudKit uses to locate the shares. - Returns: A dictionary of acceptance results. The dictionary uses the urls you specify in `urls` as its keys. The value of each key is a <doc://com.apple.documentation/documentation/swift/result>: `.success(())` when CloudKit grants access to that share, or an error that describes why CloudKit can't request access to that share. This method requests access to shares asynchronously and with a low priority. If you want the task to execute with a higher priority, create an instance of ``CKShareRequestAccessOperation`` and configure it to use the necessary priority.

method · iOS 15.0+

fetchShareMetadatas

TypeScript
fetchShareMetadatas(urls: Array<string>, completionHandler: ((arg0: SDKHandle) => void)): void
Swift declaration
@preconcurrency func fetchShareMetadatas(for urls: [URL], completionHandler: @escaping @Sendable (Result<[URL : Result<CKShare.Metadata, any Error>], any Error>) -> Void)

Fetches share metadatas for the specified share URLs. - Parameters: - urls: The share URLs that CloudKit uses to locate the metadatas. - completionHandler: The handler to execute with the fetch results. The closure doesn't return a value and takes the following parameters: - A dictionary of fetched share metadatas. The dictionary uses the URLs you specify in `urls` as its keys. The value of each key is a <doc://com.apple.documentation/documentation/swift/result> that contains either the corresponding fetched share metadata, or an error that describes why CloudKit can't fetch that share metadata. This method searches for share metadatas asynchronously and with a low priority. If you want the task to execute with a higher priority, create an instance of ``CKFetchShareMetadataOperation`` and configure it to use the necessary priority.

method · iOS 15.0+ · Deprecated in iOS 17.0

discoverUserIdentities

TypeScript
discoverUserIdentitiesForUserRecordIDsCompletionHandler(userRecordIDs: Array<CKRecord_ID>, completionHandler: ((arg0: SDKHandle) => void)): void
Swift declaration
@preconcurrency func discoverUserIdentities(forUserRecordIDs userRecordIDs: [CKRecord.ID], completionHandler: @escaping @Sendable (Result<[CKRecord.ID : CKUserIdentity], any Error>) -> Void)

Fetches the user identities for the specified user record IDs. - Parameters: - userRecordIDs: The users' user records IDs. - completionHandler: The handler to execute with the fetch results. This closure doesn't return a value and takes the following parameters: - A <doc://com.apple.documentation/documentation/swift/result> that contains either a dictionary of user identities, or an error that describes why CloudKit can't discover the user record IDs In the successful case, the dictionary uses the user record IDs you specify in `userRecordIDs` as its keys. Only successfully discovered user identities are present in this dictionary. Use this method to retrieve the identities of users who the current user knows. The users you're searching for must meet the following criteria: - The user has run the app. - The user grants the ``CKContainer/ApplicationPermissions/userDiscoverability`` permission for the container. This method searches for users asynchronously and with a low priority. If you want the task to execute the request with a higher priority, create an instance of ``CKDiscoverUserIdentitiesOperation`` and configure it to use the necessary priority.

method · iOS 15.0+ · Deprecated in iOS 17.0

discoverUserIdentities

TypeScript
discoverUserIdentitiesForPhoneNumbersCompletionHandler(phoneNumbers: Array<string>, completionHandler: ((arg0: SDKHandle) => void)): void
Swift declaration
@preconcurrency func discoverUserIdentities(forPhoneNumbers phoneNumbers: [String], completionHandler: @escaping @Sendable (Result<[String : CKUserIdentity], any Error>) -> Void)

Fetches the user identities for the specified phone numbers. - Parameters: - phoneNumbers: The users' phone numbers. - completionHandler: The handler to execute with the fetch results. This closure doesn't return a value and takes the following parameters: - A <doc://com.apple.documentation/documentation/swift/result> that contains either a dictionary of user identities, or an error that describes why CloudKit can't discover the phone numbers. In the successful case, the dictionary uses the phone numbers you specify in `phoneNumbers` as its keys. Only successfully discovered user identities are present in this dictionary. Use this method to retrieve the identities of users who the current user knows. The users you're searching for must meet the following criteria: - The user has run the app. - The user grants the ``CKContainer/ApplicationPermissions/userDiscoverability`` permission for the container. This method searches for users asynchronously and with a low priority. If you want the task to execute the request with a higher priority, create an instance of ``CKDiscoverUserIdentitiesOperation`` and configure it to use the necessary priority.

method · iOS 15.0+ · Deprecated in iOS 17.0

discoverUserIdentities

TypeScript
discoverUserIdentitiesForEmailAddressesCompletionHandler(emails: Array<string>, completionHandler: ((arg0: SDKHandle) => void)): void
Swift declaration
@preconcurrency func discoverUserIdentities(forEmailAddresses emails: [String], completionHandler: @escaping @Sendable (Result<[String : CKUserIdentity], any Error>) -> Void)

Fetches the user identities for the specified email addresses. - Parameters: - emails: The users' email addresses. - completionHandler: The handler to execute with the fetch results. This closure doesn't return a value and takes the following parameters: - A <doc://com.apple.documentation/documentation/swift/result> that contains either a dictionary of user identities, or an error that describes why CloudKit can't discover the email addresses. In the successful case, the dictionary uses the email addresses you specify in `emails` as its keys. Only successfully discovered user identities are present in this dictionary. Use this method to retrieve the identities of users who the current user knows. The users you're searching for must meet the following criteria: - The user has run the app. - The user grants the ``CKContainer/ApplicationPermissions/userDiscoverability`` permission for the container. This method searches for users asynchronously and with a low priority. If you want the task to execute the request with a higher priority, create an instance of ``CKDiscoverUserIdentitiesOperation`` and configure it to use the necessary priority.

method · iOS 15.0+

fetchShareParticipants

TypeScript
fetchShareParticipantsForPhoneNumbersCompletionHandler(phoneNumbers: Array<string>, completionHandler: ((arg0: SDKHandle) => void)): void
Swift declaration
@preconcurrency func fetchShareParticipants(forPhoneNumbers phoneNumbers: [String], completionHandler: @escaping @Sendable (Result<[String : Result<CKShare.Participant, any Error>], any Error>) -> Void)

Fetches share participants with the specified phone numbers. - Parameters: - phoneNumbers: The share participants' phone numbers. - completionHandler: The handler to execute with the fetch results. The closure doesn't return a value and takes the following parameters: - A dictionary of fetched share participants. The dictionary uses the phone numbers you specify in `phoneNumbers` as its keys. The value of each key is a <doc://com.apple.documentation/documentation/swift/result> that contains either the corresponding fetched share participant, or an error that describes why CloudKit can't fetch that share participant. CloudKit can translate any valid phone number into a share participant. If the phone number doesn't correspond to a known iCloud account, then at share-accept-time, CloudKit offers the accepting participant a vetting process. The accepting participant uses this vetting process to link the phone number to an iCloud account. This method searches for share participants asynchronously and with a low priority. If you want the task to execute with a higher priority, create an instance of ``CKFetchShareParticipantsOperation`` and configure it to use the necessary priority.

method · iOS 15.0+

fetchShareParticipants

TypeScript
fetchShareParticipantsForUserRecordIDsCompletionHandler(userRecordIDs: Array<CKRecord_ID>, completionHandler: ((arg0: SDKHandle) => void)): void
Swift declaration
@preconcurrency func fetchShareParticipants(forUserRecordIDs userRecordIDs: [CKRecord.ID], completionHandler: @escaping @Sendable (Result<[CKRecord.ID : Result<CKShare.Participant, any Error>], any Error>) -> Void)

Fetches share participants with the specified user record IDs. - Parameters: - userRecordIDs: The share participants' user record IDs. - completionHandler: The handler to execute with the fetch results. The closure doesn't return a value and takes the following parameters: - A dictionary of fetched share participants. The dictionary uses the user record IDs you specify in `userRecordIDs` as its keys. The value of each key is a <doc://com.apple.documentation/documentation/swift/result> that contains either the corresponding fetched share participant, or an error that describes why CloudKit can't fetch that share participant. This method searches for share participants asynchronously and with a low priority. If you want the task to execute with a higher priority, create an instance of ``CKFetchShareParticipantsOperation`` and configure it to use the necessary priority.

method · iOS 15.0+

fetchShareParticipants

TypeScript
fetchShareParticipantsForEmailAddressesCompletionHandler(emails: Array<string>, completionHandler: ((arg0: SDKHandle) => void)): void
Swift declaration
@preconcurrency func fetchShareParticipants(forEmailAddresses emails: [String], completionHandler: @escaping @Sendable (Result<[String : Result<CKShare.Participant, any Error>], any Error>) -> Void)

Fetches share participants with the specified email addresses. - Parameters: - emails: The share participants' email addresses. - completionHandler: The handler to execute with the fetch results. The closure doesn't return a value and takes the following parameters: - A dictionary of fetched share participants. The dictionary uses the email addresses you specify in `emails` as its keys. The value of each key is a <doc://com.apple.documentation/documentation/swift/result> that contains either the corresponding fetched share participant, or an error that describes why CloudKit can't fetch that share participant. CloudKit can translate any valid email address into a share participant. If the email address doesn't correspond to a known iCloud account, then at share-accept-time, CloudKit offers the accepting participant a vetting process. The accepting participant uses this vetting process to link the email address to an iCloud account. This method searches for share participants asynchronously and with a low priority. If you want the task to execute with a higher priority, create an instance of ``CKFetchShareParticipantsOperation`` and configure it to use the necessary priority.

method · iOS 9.3+

fetchLongLivedOperation

TypeScript
fetchLongLivedOperation(operationID: string, completionHandler: ((arg0: (CKOperation) | null, arg1: (NativeError) | null) => void)): void
Swift declaration
@preconcurrency func fetchLongLivedOperation(withID operationID: CKOperation.ID, completionHandler: @escaping @Sendable (CKOperation?, (any Error)?) -> Void)

Fetches the long-lived operation for the specified operation ID. - Parameters: - operationID: The operation's ID. - completionHandler: The closure to execute with the fetch results. The closure doesn't return a value and takes the following parameters: - The long-lived operation. If the operation completes, or your app or the system cancels it, this parameter is `nil`. - An error if a problem occurs, or `nil` if CloudKit successfully retrieves the operation. A long-lived operation is one that continues to run after the user closes your app. When a long-lived operation completes, the system calls its completion block to notify you. After setting callback blocks on the returned long-lived operation, and starting the returned long-lived operation on an operation queue, the operation invokes all callbacks made while your app was closed.

method · iOS 15.0+

allLongLivedOperationIDs

TypeScript
allLongLivedOperationIDs(): Promise<Array<string>>
Swift declaration
func allLongLivedOperationIDs() async throws -> [CKOperation.ID]

Fetches the IDs of any long-lived operations that are running and returns them to an awaiting caller. - Returns: The IDs of all of the long-lived operations that are running. A long-lived operation is one that continues to run after the user closes your app. When a long-lived operation completes, or your app or the system cancels it, it's no longer active and CloudKit doesn't include its ID in the returned array. An operation is complete when the system calls its completion handler. Use the ``CKContainer/longLivedOperation(for:)`` method to fetch the operation for a specific ID.

method · iOS 15.0+ · Deprecated in iOS 17.0

allUserIdentitiesFromContacts

TypeScript
allUserIdentitiesFromContacts(): Promise<Array<CKUserIdentity>>
Swift declaration
func allUserIdentitiesFromContacts() async throws -> [CKUserIdentity]

Fetches all user identities that match entries in the user's Contacts. - Returns: The user identities that match entries in the user's Contacts. This method searches for the users asynchronously and with a low priority. If you want the task to execute with a higher priority, create an instance of ``CKDiscoverAllUserIdentitiesOperation`` and configure it to use the necessary priority.

method · iOS 9.3+

fetchAllLongLivedOperationIDs

TypeScript
fetchAllLongLivedOperationIDs(completionHandler: ((arg0: (Array<string>) | null, arg1: (NativeError) | null) => void)): void
Swift declaration
@preconcurrency func fetchAllLongLivedOperationIDs(completionHandler: @escaping @Sendable ([CKOperation.ID]?, (any Error)?) -> Void)

Fetches the IDs of any long-lived operations that are running. - Parameters: - completionHandler: The closure to execute with the fetch results. The closure doesn't return a value and takes the following parameters: - The IDs of all of the long-lived operations that are running. - An error if a problem occurs, or `nil` if CloudKit successfully retrieves the IDs. A long-lived operation is one that continues to run after the user closes your app. When a long-lived operation completes, or your app or the system cancels it, it's no longer active and CloudKit doesn't include its ID in `outstandingOperationsByIDs`. An operation is complete when the system calls its completion handler. Use the ``CKContainer/longLivedOperation(for:)`` method to fetch the operation for a specific ID.

method · iOS 15.0+

accept

TypeScript
acceptCompletionHandler19311(metadatas: Array<CKShare_Metadata>, completionHandler: ((arg0: SDKHandle) => void)): void
Swift declaration
@preconcurrency func accept(_ metadatas: [CKShare.Metadata], completionHandler: @escaping @Sendable (Result<[CKShare.Metadata : Result<CKShare, any Error>], any Error>) -> Void)

Accepts the specified share metadatas. - Parameters: - metadatas: The metadatas of the shares to accept. - completionHandler: The handler to execute when the process finishes. The closure doesn't return a value and takes the following parameters: - A dictionary of fetched shares. The dictionary uses the metadatas you specify in `metadatas` as its keys. The value of each key is a <doc://com.apple.documentation/documentation/swift/result> that contains either the corresponding fetched share, or an error that describes why CloudKit can't fetch that share. This method accepts shares asynchronously and with a low priority. If you want the task to execute with a higher priority, create an instance of ``CKAcceptSharesOperation`` and configure it to use the necessary priority.

method · iOS 15.0+

accept

TypeScript
accept(metadatas: Array<CKShare_Metadata>): Promise<NativeMap<CKShare_Metadata, SDKHandle>>
Swift declaration
func accept(_ metadatas: [CKShare.Metadata]) async throws -> [CKShare.Metadata : Result<CKShare, any Error>]

Accepts the specified share metadatas and returns the accepted shares to an awaiting caller. - Parameters: - metadatas: The share metadatas of the shares to accept. - Returns: A dictionary of accepted shares. The dictionary uses the share metadatas you specify in `metadatas` as its keys. The value of each key is a <doc://com.apple.documentation/documentation/swift/result> that contains either the corresponding accepted share, or an error that describes why CloudKit can't accept that share. This method accepts shares asynchronously and with a low priority. If you want the task to execute with a higher priority, create an instance of ``CKAcceptSharesOperation`` and configure it to use the necessary priority.

method · iOS 15.0+

accept

TypeScript
accept27794(metadata: CKShare_Metadata): Promise<CKShare>
Swift declaration
func accept(_ metadata: CKShare.Metadata) async throws -> CKShare

Accepts the specified share metadata and returns the accepted share to an awaiting caller. - Parameters: - metadata: The metadata of the share to accept. - Returns: The corresponding share for the share metadata.

Skipped declarations

1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

CKContainer.init()

inherited init: cannot prove legal (class declares 1 custom initializer)

All CloudKit types →