Instance Method

initWithQueryString:attributes:

Initializes and returns a query object with the specified query string and item attributes.

Declaration

- (instancetype)initWithQueryString:(NSString *)queryString attributes:(NSArray<NSString *> *)attributes;

Parameters

queryString

A formatted string that defines the matching criteria to apply to indexed items. To learn how to construct a query string, see Creating a Query String.

This parameter must not be nil.

attributes

An array of strings that represent the attributes of indexed items. Each string corresponds to a property name that can be set for an item; for a list of possible properties, see CSSearchableItemAttributeSet. Passing nil for this parameter means that the query does not use attributes to find matching items.

Return Value

An initialized query object.

Discussion

After you create and initialize a query object, and call start to begin the query, you can’t update or reuse the query object for a new query.

See Also

Creating a Query Object

CSSearchQueryString

Provides the key within the NSUserActivity object’s userInfo dictionary for which the value is the string that represents the user’s current query.

CSQueryContinuationActionType

Indicates that the activity type to continue is a search or query.

protectionClasses

An array of data protection classes that correspond to the protection classes associated with the indexed items.