Instance Method

save(_:completionHandler:)

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

Declaration

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

Parameters

subscription

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

completionHandler

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:

subscription

The subscription object you attempted to save.

error

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.

Discussion

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.

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