PFQuery Class Reference

Inherits from NSObject
Conforms to NSCopying
Declared in PFQuery.h

Overview

The PFQuery class defines a query that is used to query for PFObjects.

Creating a Query for a Class

– initWithClassName:

Initializes the query with a class name.

- (instancetype)initWithClassName:(NSString *)className

Parameters

className

The class name.

Declared In

PFQuery.h

+ queryWithClassName:

Returns a PFQuery for a given class.

+ (instancetype)queryWithClassName:(NSString *)className

Parameters

className

The class to query on.

Return Value

A PFQuery object.

Declared In

PFQuery.h

+ queryWithClassName:predicate:

Creates a PFQuery with the constraints given by predicate.

+ (instancetype)queryWithClassName:(NSString *)className predicate:(PF_NULLABLE NSPredicate *)predicate

Parameters

className

The class to query on.

predicate

The predicate to create conditions from.

Discussion

The following types of predicates are supported:

  • Simple comparisons such as =, !=, <, >, <=, >=, and BETWEEN with a key and a constant.
  • Containment predicates, such as x IN {1, 2, 3}.
  • Key-existence predicates, such as x IN SELF.
  • BEGINSWITH expressions.
  • Compound predicates with AND, OR, and NOT.
  • SubQueries with key IN %@, subquery.

The following types of predicates are NOT supported:

  • Aggregate operations, such as ANY, SOME, ALL, or NONE.
  • Regular expressions, such as LIKE, MATCHES, CONTAINS, or ENDSWITH.
  • Predicates comparing one key to another.
  • Complex predicates with many ORed clauses.

Declared In

PFQuery.h

  parseClassName

The class name to query for.

@property (nonatomic, strong) NSString *parseClassName

Discussion

The class name to query for.

Declared In

PFQuery.h

Adding Basic Constraints

– includeKey:

Make the query include PFObjects that have a reference stored at the provided key.

- (instancetype)includeKey:(NSString *)key

Parameters

key

The key to load child PFObjects for.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Discussion

This has an effect similar to a join. You can use dot notation to specify which fields in the included object are also fetch.

Declared In

PFQuery.h

– selectKeys:

Make the query restrict the fields of the returned PFObjects to include only the provided keys.

- (instancetype)selectKeys:(NSArray *)keys

Parameters

keys

The keys to include in the result.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Discussion

If this is called multiple times, then all of the keys specified in each of the calls will be included.

Declared In

PFQuery.h

– whereKeyExists:

Add a constraint that requires a particular key exists.

- (instancetype)whereKeyExists:(NSString *)key

Parameters

key

The key that should exist.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Declared In

PFQuery.h

– whereKeyDoesNotExist:

Add a constraint that requires a key not exist.

- (instancetype)whereKeyDoesNotExist:(NSString *)key

Parameters

key

The key that should not exist.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Declared In

PFQuery.h

– whereKey:equalTo:

Add a constraint to the query that requires a particular key’s object to be equal to the provided object.

- (instancetype)whereKey:(NSString *)key equalTo:(id)object

Parameters

key

The key to be constrained.

object

The object that must be equalled.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Declared In

PFQuery.h

– whereKey:lessThan:

Add a constraint to the query that requires a particular key’s object to be less than the provided object.

- (instancetype)whereKey:(NSString *)key lessThan:(id)object

Parameters

key

The key to be constrained.

object

The object that provides an upper bound.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Declared In

PFQuery.h

– whereKey:lessThanOrEqualTo:

Add a constraint to the query that requires a particular key’s object to be less than or equal to the provided object.

- (instancetype)whereKey:(NSString *)key lessThanOrEqualTo:(id)object

Parameters

key

The key to be constrained.

object

The object that must be equalled.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Declared In

PFQuery.h

– whereKey:greaterThan:

Add a constraint to the query that requires a particular key’s object to be greater than the provided object.

- (instancetype)whereKey:(NSString *)key greaterThan:(id)object

Parameters

key

The key to be constrained.

object

The object that must be equalled.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Declared In

PFQuery.h

– whereKey:greaterThanOrEqualTo:

Add a constraint to the query that requires a particular key’s object to be greater than or equal to the provided object.

- (instancetype)whereKey:(NSString *)key greaterThanOrEqualTo:(id)object

Parameters

key

The key to be constrained.

object

The object that must be equalled.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Declared In

PFQuery.h

– whereKey:notEqualTo:

Add a constraint to the query that requires a particular key’s object to be not equal to the provided object.

- (instancetype)whereKey:(NSString *)key notEqualTo:(id)object

Parameters

key

The key to be constrained.

object

The object that must not be equalled.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Declared In

PFQuery.h

– whereKey:containedIn:

Add a constraint to the query that requires a particular key’s object to be contained in the provided array.

- (instancetype)whereKey:(NSString *)key containedIn:(NSArray *)array

Parameters

key

The key to be constrained.

array

The possible values for the key’s object.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Declared In

PFQuery.h

– whereKey:notContainedIn:

Add a constraint to the query that requires a particular key’s object not be contained in the provided array.

- (instancetype)whereKey:(NSString *)key notContainedIn:(NSArray *)array

Parameters

key

The key to be constrained.

array

The list of values the key’s object should not be.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Declared In

PFQuery.h

– whereKey:containsAllObjectsInArray:

Add a constraint to the query that requires a particular key’s array contains every element of the provided array.

- (instancetype)whereKey:(NSString *)key containsAllObjectsInArray:(NSArray *)array

Parameters

key

The key to be constrained.

array

The array of values to search for.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Declared In

PFQuery.h

Adding Location Constraints

– whereKey:nearGeoPoint:

Add a constraint to the query that requires a particular key’s coordinates (specified via PFGeoPoint) be near a reference point.

- (instancetype)whereKey:(NSString *)key nearGeoPoint:(PFGeoPoint *)geopoint

Parameters

key

The key to be constrained.

geopoint

The reference point represented as a PFGeoPoint.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Discussion

Distance is calculated based on angular distance on a sphere. Results will be sorted by distance from reference point.

Declared In

PFQuery.h

– whereKey:nearGeoPoint:withinMiles:

Add a constraint to the query that requires a particular key’s coordinates (specified via PFGeoPoint) be near a reference point and within the maximum distance specified (in miles).

- (instancetype)whereKey:(NSString *)key nearGeoPoint:(PFGeoPoint *)geopoint withinMiles:(double)maxDistance

Parameters

key

The key to be constrained.

geopoint

The reference point represented as a PFGeoPoint.

maxDistance

Maximum distance in miles.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Discussion

Distance is calculated based on a spherical coordinate system. Results will be sorted by distance (nearest to farthest) from the reference point.

Declared In

PFQuery.h

– whereKey:nearGeoPoint:withinKilometers:

Add a constraint to the query that requires a particular key’s coordinates (specified via PFGeoPoint) be near a reference point and within the maximum distance specified (in kilometers).

- (instancetype)whereKey:(NSString *)key nearGeoPoint:(PFGeoPoint *)geopoint withinKilometers:(double)maxDistance

Parameters

key

The key to be constrained.

geopoint

The reference point represented as a PFGeoPoint.

maxDistance

Maximum distance in kilometers.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Discussion

Distance is calculated based on a spherical coordinate system. Results will be sorted by distance (nearest to farthest) from the reference point.

Declared In

PFQuery.h

– whereKey:nearGeoPoint:withinRadians:

Add a constraint to the query that requires a particular key’s coordinates (specified via PFGeoPoint) be near a reference point and within the maximum distance specified (in radians). Distance is calculated based on angular distance on a sphere. Results will be sorted by distance (nearest to farthest) from the reference point.

- (instancetype)whereKey:(NSString *)key nearGeoPoint:(PFGeoPoint *)geopoint withinRadians:(double)maxDistance

Parameters

key

The key to be constrained.

geopoint

The reference point as a PFGeoPoint.

maxDistance

Maximum distance in radians.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Discussion

Add a constraint to the query that requires a particular key’s coordinates (specified via PFGeoPoint) be near a reference point and within the maximum distance specified (in radians). Distance is calculated based on angular distance on a sphere. Results will be sorted by distance (nearest to farthest) from the reference point.

Declared In

PFQuery.h

– whereKey:withinGeoBoxFromSouthwest:toNortheast:

Add a constraint to the query that requires a particular key’s coordinates (specified via PFGeoPoint) be contained within a given rectangular geographic bounding box.

- (instancetype)whereKey:(NSString *)key withinGeoBoxFromSouthwest:(PFGeoPoint *)southwest toNortheast:(PFGeoPoint *)northeast

Parameters

key

The key to be constrained.

southwest

The lower-left inclusive corner of the box.

northeast

The upper-right inclusive corner of the box.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Declared In

PFQuery.h

Adding String Constraints

– whereKey:matchesRegex:

Add a regular expression constraint for finding string values that match the provided regular expression.

- (instancetype)whereKey:(NSString *)key matchesRegex:(NSString *)regex

Parameters

key

The key that the string to match is stored in.

regex

The regular expression pattern to match.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Discussion

Warning: This may be slow for large datasets.

Declared In

PFQuery.h

– whereKey:matchesRegex:modifiers:

Add a regular expression constraint for finding string values that match the provided regular expression.

- (instancetype)whereKey:(NSString *)key matchesRegex:(NSString *)regex modifiers:(PF_NULLABLE NSString *)modifiers

Parameters

key

The key that the string to match is stored in.

regex

The regular expression pattern to match.

modifiers

Any of the following supported PCRE modifiers: - i - Case insensitive search - m - Search across multiple lines of input

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Discussion

Warning: This may be slow for large datasets.

Declared In

PFQuery.h

– whereKey:containsString:

Add a constraint for finding string values that contain a provided substring.

- (instancetype)whereKey:(NSString *)key containsString:(PF_NULLABLE NSString *)substring

Parameters

key

The key that the string to match is stored in.

substring

The substring that the value must contain.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Discussion

Warning: This will be slow for large datasets.

Declared In

PFQuery.h

– whereKey:hasPrefix:

Add a constraint for finding string values that start with a provided prefix.

- (instancetype)whereKey:(NSString *)key hasPrefix:(PF_NULLABLE NSString *)prefix

Parameters

key

The key that the string to match is stored in.

prefix

The substring that the value must start with.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Discussion

This will use smart indexing, so it will be fast for large datasets.

Declared In

PFQuery.h

– whereKey:hasSuffix:

Add a constraint for finding string values that end with a provided suffix.

- (instancetype)whereKey:(NSString *)key hasSuffix:(PF_NULLABLE NSString *)suffix

Parameters

key

The key that the string to match is stored in.

suffix

The substring that the value must end with.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Discussion

Warning: This will be slow for large datasets.

Declared In

PFQuery.h

Adding Subqueries

+ orQueryWithSubqueries:

Returns a PFQuery that is the or of the passed in queries.

+ (instancetype)orQueryWithSubqueries:(NSArray *)queries

Parameters

queries

The list of queries to or together.

Return Value

An instance of PFQuery that is the or of the passed in queries.

Discussion

Returns a PFQuery that is the or of the passed in queries.

Declared In

PFQuery.h

– whereKey:matchesKey:inQuery:

Adds a constraint that requires that a key’s value matches a value in another key in objects returned by a sub query.

- (instancetype)whereKey:(NSString *)key matchesKey:(NSString *)otherKey inQuery:(PFQuery *)query

Parameters

key

The key that the value is stored.

otherKey

The key in objects in the returned by the sub query whose value should match.

query

The query to run.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Declared In

PFQuery.h

– whereKey:doesNotMatchKey:inQuery:

Adds a constraint that requires that a key’s value NOT match a value in another key in objects returned by a sub query.

- (instancetype)whereKey:(NSString *)key doesNotMatchKey:(NSString *)otherKey inQuery:(PFQuery *)query

Parameters

key

The key that the value is stored.

otherKey

The key in objects in the returned by the sub query whose value should match.

query

The query to run.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Declared In

PFQuery.h

– whereKey:matchesQuery:

Add a constraint that requires that a key’s value matches a PFQuery constraint.

- (instancetype)whereKey:(NSString *)key matchesQuery:(PFQuery *)query

Parameters

key

The key that the value is stored in

query

The query the value should match

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Discussion

Warning: This only works where the key’s values are PFObjects or arrays of PFObjects.

Declared In

PFQuery.h

– whereKey:doesNotMatchQuery:

Add a constraint that requires that a key’s value to not match a PFQuery constraint.

- (instancetype)whereKey:(NSString *)key doesNotMatchQuery:(PFQuery *)query

Parameters

key

The key that the value is stored in

query

The query the value should not match

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Discussion

Warning: This only works where the key’s values are PFObjects or arrays of PFObjects.

Declared In

PFQuery.h

Sorting

– orderByAscending:

Sort the results in ascending order with the given key.

- (instancetype)orderByAscending:(NSString *)key

Parameters

key

The key to order by.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Declared In

PFQuery.h

– addAscendingOrder:

Additionally sort in ascending order by the given key.

- (instancetype)addAscendingOrder:(NSString *)key

Parameters

key

The key to order by.

Discussion

The previous keys provided will precedence over this key.

Declared In

PFQuery.h

– orderByDescending:

Sort the results in descending order with the given key.

- (instancetype)orderByDescending:(NSString *)key

Parameters

key

The key to order by.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Declared In

PFQuery.h

– addDescendingOrder:

Additionally sort in descending order by the given key.

- (instancetype)addDescendingOrder:(NSString *)key

Parameters

key

The key to order by.

Discussion

The previous keys provided will precedence over this key.

Declared In

PFQuery.h

– orderBySortDescriptor:

Sort the results using a given sort descriptor.

- (instancetype)orderBySortDescriptor:(NSSortDescriptor *)sortDescriptor

Parameters

sortDescriptor

The NSSortDescriptor to use to sort the results of the query.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Discussion

Warning: If a sortDescriptor has custom selector or comparator - they aren’t going to be used.

Declared In

PFQuery.h

– orderBySortDescriptors:

Sort the results using a given array of sort descriptors.

- (instancetype)orderBySortDescriptors:(PF_NULLABLE NSArray *)sortDescriptors

Parameters

sortDescriptors

An array of NSSortDescriptor objects to use to sort the results of the query.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Discussion

Warning: If a sortDescriptor has custom selector or comparator - they aren’t going to be used.

Declared In

PFQuery.h

Getting Objects by ID

+ getObjectOfClass:objectId:

Returns a PFObject with a given class and id.

+ (PF_NULLABLE PFObject *)getObjectOfClass:(NSString *)objectClass objectId:(NSString *)objectId

Parameters

objectClass

The class name for the object that is being requested.

objectId

The id of the object that is being requested.

Return Value

The PFObject if found. Returns nil if the object isn’t found, or if there was an error.

Declared In

PFQuery.h

+ getObjectOfClass:objectId:error:

Returns a PFObject with a given class and id and sets an error if necessary.

+ (PF_NULLABLE PFObject *)getObjectOfClass:(NSString *)objectClass objectId:(NSString *)objectId error:(NSError **)error

Parameters

objectClass

The class name for the object that is being requested.

objectId

The id of the object that is being requested.

error

Pointer to an NSError that will be set if necessary.

Return Value

The PFObject if found. Returns nil if the object isn’t found, or if there was an error.

Declared In

PFQuery.h

– getObjectWithId:

Returns a PFObject with the given id.

- (PF_NULLABLE PFObject *)getObjectWithId:(NSString *)objectId

Parameters

objectId

The id of the object that is being requested.

Return Value

The PFObject if found. Returns nil if the object isn’t found, or if there was an error.

Discussion

Warning: This method mutates the query. It will reset limit to 1, skip to 0 and remove all conditions, leaving only objectId.

Declared In

PFQuery.h

– getObjectWithId:error:

Returns a PFObject with the given id and sets an error if necessary.

- (PF_NULLABLE PFObject *)getObjectWithId:(NSString *)objectId error:(NSError **)error

Parameters

objectId

The id of the object that is being requested.

error

Pointer to an NSError that will be set if necessary.

Return Value

The PFObject if found. Returns nil if the object isn’t found, or if there was an error.

Discussion

Warning: This method mutates the query. It will reset limit to 1, skip to 0 and remove all conditions, leaving only objectId.

Declared In

PFQuery.h

– getObjectInBackgroundWithId:

Gets a PFObject asynchronously and calls the given block with the result.

- (BFTask *)getObjectInBackgroundWithId:(NSString *)objectId

Parameters

objectId

The id of the object that is being requested.

Return Value

The task, that encapsulates the work being done.

Discussion

Warning: This method mutates the query. It will reset limit to 1, skip to 0 and remove all conditions, leaving only objectId.

Declared In

PFQuery.h

– getObjectInBackgroundWithId:block:

Gets a PFObject asynchronously and calls the given block with the result.

- (void)getObjectInBackgroundWithId:(NSString *)objectId block:(PF_NULLABLE PFObjectResultBlock)block

Parameters

objectId

The id of the object that is being requested.

block

The block to execute. The block should have the following argument signature: ^(NSArray *object, NSError *error)

Discussion

Warning: This method mutates the query. It will reset limit to 1, skip to 0 and remove all conditions, leaving only objectId.

Declared In

PFQuery.h

Getting User Objects

+ getUserObjectWithId:

Returns a PFUser with a given id.

+ (PF_NULLABLE PFUser *)getUserObjectWithId:(NSString *)objectId

Parameters

objectId

The id of the object that is being requested.

Return Value

The PFUser if found. Returns nil if the object isn’t found, or if there was an error.

Declared In

PFQuery.h

+ getUserObjectWithId:error:

Returns a PFUser with a given class and id and sets an error if necessary.

+ (PF_NULLABLE PFUser *)getUserObjectWithId:(NSString *)objectId error:(NSError **)error

Parameters

objectId

The id of the object that is being requested.

error

Pointer to an NSError that will be set if necessary.

Return Value

The PFUser if found. Returns nil if the object isn’t found, or if there was an error.

Discussion

Returns a PFUser with a given class and id and sets an error if necessary.

Declared In

PFQuery.h

+ queryForUser

Please use [PFUser query] instead. (Deprecated: Please use [PFUser query] instead.)

+ (instancetype)queryForUser

Declared In

PFQuery.h

Getting all Matches for a Query

– findObjects

Finds objects synchronously based on the constructed query.

- (PF_NULLABLE NSArray *)findObjects

Return Value

Returns an array of PFObject objects that were found.

Declared In

PFQuery.h

– findObjects:

Finds objects synchronously based on the constructed query and sets an error if there was one.

- (PF_NULLABLE NSArray *)findObjects:(NSError **)error

Parameters

error

Pointer to an NSError that will be set if necessary.

Return Value

Returns an array of PFObject objects that were found.

Declared In

PFQuery.h

– findObjectsInBackground

Finds objects asynchronously and sets the NSArray of PFObject objects as a result of the task.

- (BFTask *)findObjectsInBackground

Return Value

The task, that encapsulates the work being done.

Declared In

PFQuery.h

– findObjectsInBackgroundWithBlock:

Finds objects asynchronously and calls the given block with the results.

- (void)findObjectsInBackgroundWithBlock:(PF_NULLABLE PFArrayResultBlock)block

Parameters

block

The block to execute. It should have the following argument signature: ^(NSArray *objects, NSError *error)

Declared In

PFQuery.h

Getting the First Match in a Query

– getFirstObject

Gets an object synchronously based on the constructed query.

- (PF_NULLABLE PFObject *)getFirstObject

Return Value

Returns a PFObject, or nil if none was found.

Discussion

Warning: This method mutates the query. It will reset the limit to 1.

Declared In

PFQuery.h

– getFirstObject:

Gets an object synchronously based on the constructed query and sets an error if any occurred.

- (PF_NULLABLE PFObject *)getFirstObject:(NSError **)error

Parameters

error

Pointer to an NSError that will be set if necessary.

Return Value

Returns a PFObject, or nil if none was found.

Discussion

Warning: This method mutates the query. It will reset the limit to 1.

Declared In

PFQuery.h

– getFirstObjectInBackground

Gets an object asynchronously and sets it as a result of the task.

- (BFTask *)getFirstObjectInBackground

Return Value

The task, that encapsulates the work being done.

Discussion

Warning: This method mutates the query. It will reset the limit to 1.

Declared In

PFQuery.h

– getFirstObjectInBackgroundWithBlock:

Gets an object asynchronously and calls the given block with the result.

- (void)getFirstObjectInBackgroundWithBlock:(PF_NULLABLE PFObjectResultBlock)block

Parameters

block

The block to execute. It should have the following argument signature: ^(PFObject *object, NSError *error). result will be nil if error is set OR no object was found matching the query. error will be nil if result is set OR if the query succeeded, but found no results.

Discussion

Warning: This method mutates the query. It will reset the limit to 1.

Declared In

PFQuery.h

Counting the Matches in a Query

– countObjects

Counts objects synchronously based on the constructed query.

- (NSInteger)countObjects

Return Value

Returns the number of PFObject objects that match the query, or -1 if there is an error.

Declared In

PFQuery.h

– countObjects:

Counts objects synchronously based on the constructed query and sets an error if there was one.

- (NSInteger)countObjects:(NSError **)error

Parameters

error

Pointer to an NSError that will be set if necessary.

Return Value

Returns the number of PFObject objects that match the query, or -1 if there is an error.

Declared In

PFQuery.h

– countObjectsInBackground

Counts objects asynchronously and sets NSNumber with count as a result of the task.

- (BFTask *)countObjectsInBackground

Return Value

The task, that encapsulates the work being done.

Declared In

PFQuery.h

– countObjectsInBackgroundWithBlock:

Counts objects asynchronously and calls the given block with the counts.

- (void)countObjectsInBackgroundWithBlock:(PF_NULLABLE PFIntegerResultBlock)block

Parameters

block

The block to execute. It should have the following argument signature: ^(int count, NSError *error)

Declared In

PFQuery.h

Cancelling a Query

– cancel

Cancels the current network request (if any). Ensures that callbacks won’t be called.

- (void)cancel

Declared In

PFQuery.h

Paginating Results

  limit

A limit on the number of objects to return. The default limit is 100, with a maximum of 1000 results being returned at a time.

@property (nonatomic, assign) NSInteger limit

Discussion

Warning: If you are calling findObjects with limit = 1, you may find it easier to use getFirst instead.

Declared In

PFQuery.h

  skip

The number of objects to skip before returning any.

@property (nonatomic, assign) NSInteger skip

Declared In

PFQuery.h

Controlling Caching Behavior

  cachePolicy

The cache policy to use for requests.

Not allowed when Pinning is enabled.

@property (assign, readwrite) PFCachePolicy cachePolicy

Declared In

PFQuery.h

– hasCachedResult

Returns whether there is a cached result for this query.

- (BOOL)hasCachedResult

Return Value

YES if there is a cached result for this query, otherwise NO.

Declared In

PFQuery.h

– clearCachedResult

Clears the cached result for this query. If there is no cached result, this is a noop.

- (void)clearCachedResult

Declared In

PFQuery.h

+ clearAllCachedResults

Clears the cached results for all queries.

+ (void)clearAllCachedResults

Declared In

PFQuery.h

Query Source

– fromLocalDatastore

Change the source of this query to all pinned objects.

- (instancetype)fromLocalDatastore

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Discussion

Warning: Requires Local Datastore to be enabled.

Declared In

PFQuery.h

– fromPin

Change the source of this query to the default group of pinned objects.

- (instancetype)fromPin

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Discussion

Warning: Requires Local Datastore to be enabled.

Declared In

PFQuery.h

– fromPinWithName:

Change the source of this query to a specific group of pinned objects.

- (instancetype)fromPinWithName:(PF_NULLABLE NSString *)name

Parameters

name

The pinned group.

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Discussion

Warning: Requires Local Datastore to be enabled.

Declared In

PFQuery.h

– ignoreACLs

Ignore ACLs when querying from the Local Datastore.

- (instancetype)ignoreACLs

Return Value

The same instance of PFQuery as the receiver. This allows method chaining.

Discussion

This is particularly useful when querying for objects with Role based ACLs set on them.

Warning: Requires Local Datastore to be enabled.

Declared In

PFQuery.h

Advanced Settings

  trace

Whether or not performance tracing should be done on the query.

@property (nonatomic, assign) BOOL trace

Discussion

Warning: This should not be set to YES in most cases.

Declared In

PFQuery.h