Initializes and returns a query object with the specified parameters.
- iOS 8.0+
- macOS 10.10+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 3.0+
The type of record to search. Specify the name of one of your app’s supported record types.
This method throws an exception if this parameter is
nilor contains an empty string.
The search predicate to apply to the prospective records. Only records matching the predicate criteria are returned in the search results. For guidelines on how to construct predicates for your queries, see Predicate Rules for Query Objects.
This parameter must not be
An initialized query object.
You cannot change the record type and predicate of a query object after you create it. If you want to search for a different set of records using a different set of search criteria, create a new query object. You can add sort descriptors to the query and change them later as needed.
You cannot query for user records and executing a query where the record type is set to
CKRecord results in an error. You must fetch user records directly using their ID.