Instance Method


Saves one subscription object asynchronously, with a low priority, to the current database.


func save(_ subscription: CKSubscription, completionHandler: @escaping (CKSubscription?, Error?) -> Void)



The subscription object you want to save to the database. This method throws an exception if this parameter is nil.


The block to execute with the results. Your block must be capable of running on any thread of the app and must take the following parameters:


The subscription object you attempted to save.


An error object, or nil if the subscription was saved successfully. Use the information in the error object to determine whether a problem has a workaround.


Use this method to save a subscription to the database so that the subsription can begin watching for changes.

This method saves the subscription object with a low priority, which may cause the task to execute after higher-priority tasks. To save the subscription more urgently, create a CKModifySubscriptionsOperation object with the desired priority. You can also use that operation object to save multiple subscription objects simultaneously.

See Also

Accessing Subscriptions

func fetchAllSubscriptions(completionHandler: ([CKSubscription]?, Error?) -> Void)

Fetches all subscription objects asynchronously, with a low priority, from the current database.