Instance Method

startQuery

Attempts to start the query.

Declaration

- (BOOL)startQuery;

Return Value

YES when successful; otherwise, NO.

A query may fail to start if it does not specify a predicate, or if the query has already been started.

Discussion

A query can’t be started if the receiver is already running a query or no predicate has been specified.

This method must be called from the receiver’s operationQueue or on the main thread. For example:

NSMetadataQuery *query = // Initialize and set up a query
[query.operationQueue addOperationWithBlock:^{
    [query startQuery];
}];

See Also

Running Queries

started

A Boolean value that indicates whether the query has started. (read-only)

gathering

A Boolean value that indicates whether the receiver is in the initial gathering phase of the query. (read-only)

stopped

A Boolean value that indicates whether the query has stopped.

- stopQuery

Stops the receiver’s current query from gathering any further results.