Instance Property

predicate

The matching criteria to apply to records.

Declaration

@property(nonatomic, readonly, copy) NSPredicate *predicate;

Discussion

A query-based subscription uses its search predicate to identify potential matches for records. It combines the predicate information with the value in the subscriptionOptions property to determine the conditions under which to send a push notification to the app.

The search predicate defines the records that the subscription object monitors for changes. The value in this property is used only if the subscriptionType property is set to CKSubscriptionTypeQuery; otherwise, it is ignored.

A query-based subscription can be used to observe multiple records or a single record. An example of subscribing to the changes of a single record is shown below:

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"recordID == %@", [record recordID]];
CKQuerySubscriptionOptions options = CKQuerySubscriptionOptionsFiresOnRecordUpdate | CKQuerySubscriptionOptionsFiresOnRecordDeletion;
CKSubscription *subscription = [[CKQuerySubscription alloc] initWithRecordType:@"Employee" predicate:predicate options:options];

See Also

Accessing the Subscription Search Parameters

zoneID

The ID of the record zone to monitor.

Deprecated
recordType

The record type being monitored in a query-based subscription.

Deprecated