Contents

modifySubscriptions(saving:deleting:)

Modifies the specified subscriptions and returns the results to an awaiting caller.

Declaration

func modifySubscriptions(saving subscriptionsToSave: [CKSubscription], deleting subscriptionIDsToDelete: [CKSubscription.ID]) async throws -> (saveResults: [CKSubscription.ID : Result<CKSubscription, any Error>], deleteResults: [CKSubscription.ID : Result<Void, any Error>])

Parameters

  • subscriptionsToSave:

    The subscriptions to save.

  • subscriptionIDsToDelete:

    The identifiers of the subscriptions to permanently delete.

Return Value

A tuple with the following named elements:

saveResults

A dictionary of saved subscriptions. The dictionary uses the identifiers of the subscriptions you specify in subscriptionsToSave as its keys. The value of each key is a Result that contains either the corresponding modified subscription (as it appears on the server), or an error that describes why CloudKit can’t modify that subscription.

deleteResults

A dictionary of deleted subscriptions. The dictionary uses the identifiers you specify in subscriptionIDsToDelete as its keys. The value of each key is a Result that contains either Void to indicate a successful deletion, or an error that describes why CloudKit can’t delete that subscription.

Discussion

This method throws an error if the request fails, such as when the network is unavailable or the device doesn’t have an active iCloud account; otherwise, the returned tuple includes any individual subscription errors.

For information on a more configurable way to modify subscriptions, see CKModifySubscriptionsOperation.

See Also

Modifying Subscriptions