Searches the specified zone asynchronously for records that match the query parameters.
- iOS 8.0+
- macOS 10.10+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 3.0+
The query object containing the parameters for the search. This method throws an exception if this parameter is
nil. For information about how to construct queries, see
The ID of the zone to search. Search results are limited to records in the specified zone. Specify
nilto search the default zone of the database.
The block to execute with the search results. Your block must be capable of running on any thread of the app and must take the following parameters:
An array containing zero or more
CKRecordobjects. The returned records correspond to the records in the specified zone that match the parameters of the query.
An error object, or
nilif the query was completed successfully. Use the information in the error object to determine whether a problem has a workaround.
Use this method to execute searches against the current database. Do not use this method when the number of returned records is potentially more than a few hundred records; when more records are needed, create an execute a
CKQuery instead of calling
perform on the
CKDatabase. For efficiency, all queries automatically limit the number of returned records based on current conditions. If your query hits the maximum value, this method returns only the first portion of the overall results. The number of returned records should be sufficient in most cases, but to get the entire set of records you must create and execute a
CKQuery object instead. Query operations also return a maximum number of results, but when they do, they provide a cursor object that you can use to fetch the next batch of results.