LuxChat  2.0
Instant messenger for iOS
Instance Methods | Class Methods | Protected Attributes | Properties | List of all members
PFQuery Class Reference

#import <PFObject+Subclass.h>

Inheritance diagram for PFQuery:

Instance Methods

(nullable PFGenericObject) - getObjectWithId:
 
(nullable PFGenericObject) - getObjectWithId:error:
 
(nullable NSArray< PFGenericObject > *) - PF_SWIFT_UNAVAILABLE
 
More...
 
(nullable NSArray< PFGenericObject > *) - findObjects:
 
(nullable PFGenericObject) - PF_SWIFT_UNAVAILABLE
 
More...
 
(nullable PFGenericObject) - getFirstObject:
 
(NSInteger) - PF_SWIFT_UNAVAILABLE
 
More...
 
(NSInteger) - countObjects:
 
(instancetype) - initWithClassName:
 
More...
 
(instancetype) - includeKey:
 
More...
 
(instancetype) - includeKeys:
 
(instancetype) - selectKeys:
 
(instancetype) - whereKeyExists:
 
(instancetype) - whereKeyDoesNotExist:
 
(instancetype) - whereKey:equalTo:
 
(instancetype) - whereKey:lessThan:
 
(instancetype) - whereKey:lessThanOrEqualTo:
 
(instancetype) - whereKey:greaterThan:
 
(instancetype) - whereKey:greaterThanOrEqualTo:
 
(instancetype) - whereKey:notEqualTo:
 
(instancetype) - whereKey:containedIn:
 
(instancetype) - whereKey:notContainedIn:
 
(instancetype) - whereKey:containsAllObjectsInArray:
 
(instancetype) - whereKey:nearGeoPoint:
 
More...
 
(instancetype) - whereKey:nearGeoPoint:withinMiles:
 
(instancetype) - whereKey:nearGeoPoint:withinKilometers:
 
(instancetype) - whereKey:nearGeoPoint:withinRadians:
 
(instancetype) - whereKey:withinGeoBoxFromSouthwest:toNortheast:
 
(instancetype) - whereKey:matchesRegex:
 
More...
 
(instancetype) - whereKey:matchesRegex:modifiers:
 
(instancetype) - whereKey:containsString:
 
(instancetype) - whereKey:hasPrefix:
 
(instancetype) - whereKey:hasSuffix:
 
(instancetype) - whereKey:matchesKey:inQuery:
 
(instancetype) - whereKey:doesNotMatchKey:inQuery:
 
(instancetype) - whereKey:matchesQuery:
 
(instancetype) - whereKey:doesNotMatchQuery:
 
(instancetype) - orderByAscending:
 
More...
 
(instancetype) - addAscendingOrder:
 
(instancetype) - orderByDescending:
 
(instancetype) - addDescendingOrder:
 
(instancetype) - orderBySortDescriptor:
 
(instancetype) - orderBySortDescriptors:
 
(BFTask< PFGenericObject > *) - getObjectInBackgroundWithId:
 
More...
 
(void) - getObjectInBackgroundWithId:block:
 
(BFTask< NSArray< PFGenericObject > * > *) - findObjectsInBackground
 
More...
 
(void) - findObjectsInBackgroundWithBlock:
 
(BFTask< PFGenericObject > *) - getFirstObjectInBackground
 
More...
 
(void) - getFirstObjectInBackgroundWithBlock:
 
(BFTask< NSNumber * > *) - countObjectsInBackground
 
More...
 
(void) - countObjectsInBackgroundWithBlock:
 
(void) - cancel
 
More...
 
(void) - clearCachedResult
 
(instancetype) - fromLocalDatastore
 
More...
 
(instancetype) - fromPin
 
(instancetype) - fromPinWithName:
 
(instancetype) - ignoreACLs
 
(void) - getObjectInBackgroundWithId:target:selector:
 
More...
 
(void) - findObjectsInBackgroundWithTarget:selector:
 
More...
 
(void) - getFirstObjectInBackgroundWithTarget:selector:
 
More...
 
(void) - countObjectsInBackgroundWithTarget:selector:
 
More...
 

Class Methods

(nullable PFGenericObject) + getObjectOfClass:objectId:
 
More...
 
(nullable PFGenericObject) + getObjectOfClass:objectId:error:
 
(nullable PFUser *) + getUserObjectWithId:
 
More...
 
(nullable PFUser *) + getUserObjectWithId:error:
 
(instancetype) + queryWithClassName:
 
(instancetype) + queryWithClassName:predicate:
 
(instancetype) + orQueryWithSubqueries:
 
More...
 
("Use [PFUser query] instead.") + PARSE_DEPRECATED
 
More...
 
(void) + clearAllCachedResults
 

Protected Attributes

 __pad0__: NSObject<NSCopying>typedef void (^PFQueryArrayResultBlock)(NSArray<PFGenericObject> *_Nullable objects
 
NSError *_Nullable error
 

Properties

NSString * parseClassName
 
NSInteger limit
 
More...
 
NSInteger skip
 
PFCachePolicy cachePolicy
 
More...
 
NSTimeInterval maxCacheAge
 
BOOL hasCachedResult
 
BOOL trace
 
More...
 

Detailed Description

Copyright (c) 2015-present, Parse, LLC. All rights reserved.

This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. An additional grant of patent rights can be found in the PATENTS file in the same directory.

Copyright (c) 2015-present, Parse, LLC. All rights reserved.

This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. An additional grant of patent rights can be found in the PATENTS file in the same directory. This category lists all methods of PFQuery class that are synchronous, but have asynchronous counterpart, Calling one of these synchronous methods could potentially block the current thread for a large amount of time, since it might be fetching from network or saving/loading data from disk.

Copyright (c) 2015-present, Parse, LLC. All rights reserved.

This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. An additional grant of patent rights can be found in the PATENTS file in the same directory. The PFQuery class defines a query that is used to query for PFObjects.

Method Documentation

- (instancetype) addAscendingOrder: (NSString *)  key

Additionally sort in ascending order by the given key.

The previous keys provided will precedence over this key.

Parameters
keyThe key to order by.
- (instancetype) addDescendingOrder: (NSString *)  key

Additionally sort in descending order by the given key.

The previous keys provided will precedence over this key.

Parameters
keyThe key to order by.
- (void) cancel



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

+ (void) clearAllCachedResults

Clears the cached results for all queries.

- (void) clearCachedResult

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

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

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

Parameters
errorPointer to an NSError that will be set if necessary.
Returns
Returns the number of PFObject objects that match the query, or -1 if there is an error.
- (BFTask<NSNumber *> *) countObjectsInBackground



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

Returns
The task, that encapsulates the work being done.
- (void) countObjectsInBackgroundWithBlock: (nullable PFIntegerResultBlock)  block

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

Parameters
blockThe block to execute. It should have the following argument signature: ^(int count, NSError *error)
- (void) countObjectsInBackgroundWithTarget: (nullable id)  target
selector: ("Please use `PFQuery.-countObjectsInBackgroundWithBlock:` instead.")  PARSE_DEPRECATED 



Counts objects asynchronously and calls the given callback with the count.

Parameters
targetThe object to call the selector on.
selectorThe selector to call. It should have the following signature: (void)callbackWithResult:(NSNumber *)result error:(NSError *)error.
Deprecated:
Please use PFQuery.-countObjectsInBackgroundWithBlock: instead.

Provided by category PFQuery(Deprecated).

- (nullable NSArray<PFGenericObject> *) findObjects: (NSError **)  error

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

Parameters
errorPointer to an NSError that will be set if necessary.
Returns
Returns an array of PFObject objects that were found.
- (BFTask<NSArray<PFGenericObject> *> *) findObjectsInBackground



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

Returns
The task, that encapsulates the work being done.
- (void) findObjectsInBackgroundWithBlock: (nullable PFQueryArrayResultBlock)  block

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

Parameters
blockThe block to execute. It should have the following argument signature: ^(NSArray *objects, NSError *error)
- (void) findObjectsInBackgroundWithTarget: (nullable id)  target
selector: ("Please use `PFQuery.-findObjectsInBackgroundWithBlock:` instead.")  PARSE_DEPRECATED 



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

Parameters
targetThe object to call the selector on.
selectorThe selector to call. It should have the following signature: (void)callbackWithResult:(id)result error:(NSError *)error. Result will be nil if error is set and vice versa.
Deprecated:
Please use PFQuery.-findObjectsInBackgroundWithBlock: instead.

Provided by category PFQuery(Deprecated).

- (instancetype) fromLocalDatastore



Change the source of this query to all pinned objects.

Warning
Requires Local Datastore to be enabled.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
See also
cachePolicy
- (instancetype) fromPin

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

Warning
Requires Local Datastore to be enabled.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
See also
PFObjectDefaultPin
cachePolicy
- (instancetype) fromPinWithName: (nullable NSString *)  name

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

Warning
Requires Local Datastore to be enabled.
Parameters
nameThe pinned group.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
See also
PFObjectDefaultPin
cachePolicy
- (nullable PFGenericObject) getFirstObject: (NSError **)  error

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

Warning
This method mutates the query. It will reset the limit to 1.
Parameters
errorPointer to an NSError that will be set if necessary.
Returns
Returns a PFObject, or nil if none was found.
- (BFTask<PFGenericObject> *) getFirstObjectInBackground



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

Warning
This method mutates the query. It will reset the limit to 1.
Returns
The task, that encapsulates the work being done.
- (void) getFirstObjectInBackgroundWithBlock: (nullable void(^)(PFGenericObject _Nullable object, NSError *_Nullable error))  block

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

Warning
This method mutates the query. It will reset the limit to 1.
Parameters
blockThe 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.
- (void) getFirstObjectInBackgroundWithTarget: (nullable id)  target
selector: ("Please use `PFQuery.-getFirstObjectInBackgroundWithBlock:` instead.")  PARSE_DEPRECATED 



Gets an object asynchronously and calls the given callback with the results.

Warning
This method mutates the query. It will reset the limit to 1.
Parameters
targetThe object to call the selector on.
selectorThe selector to call. It should have the following signature: (void)callbackWithResult:(PFObject *)result error:(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.
Deprecated:
Please use PFQuery.-getFirstObjectInBackgroundWithBlock: instead.

Provided by category PFQuery(Deprecated).

- (BFTask<PFGenericObject> *) getObjectInBackgroundWithId: (NSString *)  objectId



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

Warning
This method mutates the query. It will reset limit to 1, skip to 0 and remove all conditions, leaving only objectId.
Parameters
objectIdThe id of the object that is being requested.
Returns
The task, that encapsulates the work being done.
- (void) getObjectInBackgroundWithId: (NSString *)  objectId
block: (nullable void(^)(PFGenericObject _Nullable object, NSError *_Nullable error))  block 

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

Warning
This method mutates the query. It will reset limit to 1, skip to 0 and remove all conditions, leaving only objectId.
Parameters
objectIdThe id of the object that is being requested.
blockThe block to execute. The block should have the following argument signature: ^(NSArray *object, NSError *error)
- (void) getObjectInBackgroundWithId: (NSString *)  objectId
target: (nullable id)  target
selector: ("Please use `PFQuery.-getObjectInBackgroundWithId:block:` instead.")  PARSE_DEPRECATED 



Gets a PFObject asynchronously.

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

Parameters
objectIdThe id of the object being requested.
targetThe target for the callback selector.
selectorThe selector for the callback. It should have the following signature: (void)callbackWithResult:(id)result error:(NSError *)error. Result will be nil if error is set and vice versa.
Deprecated:
Please use PFQuery.-getObjectInBackgroundWithId:block: instead.

Provided by category PFQuery(Deprecated).

+ (nullable PFGenericObject) getObjectOfClass: (NSString *)  objectClass
objectId: (NSString *)  PF_SWIFT_UNAVAILABLE 



Returns a PFObject with a given class and id.

Parameters
objectClassThe class name for the object that is being requested.
objectIdThe id of the object that is being requested.
Returns
The PFObject if found. Returns nil if the object isn't found, or if there was an error.
+ (nullable PFGenericObject) getObjectOfClass: (NSString *)  objectClass
objectId: (NSString *)  objectId
error: (NSError **)  error 

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

Parameters
objectClassThe class name for the object that is being requested.
objectIdThe id of the object that is being requested.
errorPointer to an NSError that will be set if necessary.
Returns
The PFObject if found. Returns nil if the object isn't found, or if there was an error.
- (nullable PFGenericObject) getObjectWithId: (NSString *)  PF_SWIFT_UNAVAILABLE

Returns a PFObject with the given id.

Warning
This method mutates the query. It will reset limit to 1, skip to 0 and remove all conditions, leaving only objectId.
Parameters
objectIdThe id of the object that is being requested.
Returns
The PFObject if found. Returns nil if the object isn't found, or if there was an error.
- (nullable PFGenericObject) getObjectWithId: (NSString *)  objectId
error: (NSError **)  error 

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

Warning
This method mutates the query. It will reset limit to 1, skip to 0 and remove all conditions, leaving only objectId.
Parameters
objectIdThe id of the object that is being requested.
errorPointer to an NSError that will be set if necessary.
Returns
The PFObject if found. Returns nil if the object isn't found, or if there was an error.
+ (nullable PFUser *) getUserObjectWithId: (NSString *)  PF_SWIFT_UNAVAILABLE



Returns a PFUser with a given id.

Parameters
objectIdThe id of the object that is being requested.
Returns
The PFUser if found. Returns nil if the object isn't found, or if there was an error.
+ (nullable PFUser *) getUserObjectWithId: (NSString *)  objectId
error: (NSError **)  error 

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

Parameters
objectIdThe id of the object that is being requested.
errorPointer to an NSError that will be set if necessary.
Returns
The PFUser if found. Returns nil if the object isn't found, or if there was an error.
- (instancetype) ignoreACLs

Ignore ACLs when querying from the Local Datastore.

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

Warning
Requires Local Datastore to be enabled.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) includeKey: (NSString *)  key



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

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

Parameters
keyThe key to load child PFObjects for.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) includeKeys: (NSArray< NSString * > *)  keys

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

Parameters
keysThe keys to load child PFObjects for.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) initWithClassName: (NSString *)  className



Initializes the query with a class name.

Parameters
classNameThe class name.
- (instancetype) orderByAscending: (NSString *)  key



Sort the results in ascending order with the given key.

Parameters
keyThe key to order by.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) orderByDescending: (NSString *)  key

Sort the results in descending order with the given key.

Parameters
keyThe key to order by.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) orderBySortDescriptor: (NSSortDescriptor *)  sortDescriptor

Sort the results using a given sort descriptor.

Warning
If a sortDescriptor has custom selector or comparator - they aren't going to be used.
Parameters
sortDescriptorThe NSSortDescriptor to use to sort the results of the query.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) orderBySortDescriptors: (nullable NSArray< NSSortDescriptor * > *)  sortDescriptors

Sort the results using a given array of sort descriptors.

Warning
If a sortDescriptor has custom selector or comparator - they aren't going to be used.
Parameters
sortDescriptorsAn array of NSSortDescriptor objects to use to sort the results of the query.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
+ (instancetype) orQueryWithSubqueries: (NSArray< PFQuery * > *)  queries



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

Parameters
queriesThe list of queries to or together.
Returns
An instance of PFQuery that is the or of the passed in queries.
+ ("Use [PFUser query] instead.") PARSE_DEPRECATED



Deprecated:
Please use [PFUser query] instead.
- (nullable PFGenericObject) PF_SWIFT_UNAVAILABLE



Gets an object synchronously based on the constructed query.

Warning
This method mutates the query. It will reset the limit to 1.
Returns
Returns a PFObject, or nil if none was found.
- (NSInteger) PF_SWIFT_UNAVAILABLE



Counts objects synchronously based on the constructed query.

Returns
Returns the number of PFObject objects that match the query, or -1 if there is an error.
- (nullable NSArray<PFGenericObject> *) PF_SWIFT_UNAVAILABLE



Finds objects synchronously based on the constructed query.

Returns
Returns an array of PFObject objects that were found.
+ (instancetype) queryWithClassName: (NSString *)  className

Returns a PFQuery for a given class.

Parameters
classNameThe class to query on.
Returns
A PFQuery object.
+ (instancetype) queryWithClassName: (NSString *)  className
predicate: (nullable NSPredicate *)  predicate 

Creates a PFQuery with the constraints given by predicate.

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.
Parameters
classNameThe class to query on.
predicateThe predicate to create conditions from.
- (instancetype) selectKeys: (NSArray< NSString * > *)  keys

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

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

Parameters
keysThe keys to include in the result.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
containedIn: (NSArray *)  array 

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

Parameters
keyThe key to be constrained.
arrayThe possible values for the key's object.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
containsAllObjectsInArray: (NSArray *)  array 

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

Parameters
keyThe key to be constrained.
arrayThe array of values to search for.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
containsString: (nullable NSString *)  substring 

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

Warning
This will be slow for large datasets.
Parameters
keyThe key that the string to match is stored in.
substringThe substring that the value must contain.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
doesNotMatchKey: (NSString *)  otherKey
inQuery: (PFQuery *)  query 

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

Parameters
keyThe key that the value is stored.
otherKeyThe key in objects in the returned by the sub query whose value should match.
queryThe query to run.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
doesNotMatchQuery: (PFQuery *)  query 

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

Warning
This only works where the key's values are PFObjects or arrays of PFObjects.
Parameters
keyThe key that the value is stored in
queryThe query the value should not match
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
equalTo: (id)  object 

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

Parameters
keyThe key to be constrained.
objectThe object that must be equalled.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
greaterThan: (id)  object 

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

Parameters
keyThe key to be constrained.
objectThe object that must be equalled.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
greaterThanOrEqualTo: (id)  object 

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

Parameters
keyThe key to be constrained.
objectThe object that must be equalled.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
hasPrefix: (nullable NSString *)  prefix 

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

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

Parameters
keyThe key that the string to match is stored in.
prefixThe substring that the value must start with.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
hasSuffix: (nullable NSString *)  suffix 

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

Warning
This will be slow for large datasets.
Parameters
keyThe key that the string to match is stored in.
suffixThe substring that the value must end with.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
lessThan: (id)  object 

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

Parameters
keyThe key to be constrained.
objectThe object that provides an upper bound.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
lessThanOrEqualTo: (id)  object 

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

Parameters
keyThe key to be constrained.
objectThe object that must be equalled.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
matchesKey: (NSString *)  otherKey
inQuery: (PFQuery *)  query 

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

Parameters
keyThe key that the value is stored.
otherKeyThe key in objects in the returned by the sub query whose value should match.
queryThe query to run.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
matchesQuery: (PFQuery *)  query 

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

Warning
This only works where the key's values are PFObjects or arrays of PFObjects.
Parameters
keyThe key that the value is stored in
queryThe query the value should match
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
matchesRegex: (NSString *)  regex 



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

Warning
This may be slow for large datasets.
Parameters
keyThe key that the string to match is stored in.
regexThe regular expression pattern to match.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
matchesRegex: (NSString *)  regex
modifiers: (nullable NSString *)  modifiers 

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

Warning
This may be slow for large datasets.
Parameters
keyThe key that the string to match is stored in.
regexThe regular expression pattern to match.
modifiersAny of the following supported PCRE modifiers:
  • i - Case insensitive search
  • m - Search across multiple lines of input
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
nearGeoPoint: (PFGeoPoint *)  geopoint 



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

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

Parameters
keyThe key to be constrained.
geopointThe reference point represented as a PFGeoPoint.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
nearGeoPoint: (PFGeoPoint *)  geopoint
withinKilometers: (double)  maxDistance 

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).

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

Parameters
keyThe key to be constrained.
geopointThe reference point represented as a PFGeoPoint.
maxDistanceMaximum distance in kilometers.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
nearGeoPoint: (PFGeoPoint *)  geopoint
withinMiles: (double)  maxDistance 

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).

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

Parameters
keyThe key to be constrained.
geopointThe reference point represented as a PFGeoPoint.
maxDistanceMaximum distance in miles.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
nearGeoPoint: (PFGeoPoint *)  geopoint
withinRadians: (double)  maxDistance 

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.

Parameters
keyThe key to be constrained.
geopointThe reference point as a PFGeoPoint.
maxDistanceMaximum distance in radians.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
notContainedIn: (NSArray *)  array 

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

Parameters
keyThe key to be constrained.
arrayThe list of values the key's object should not be.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
notEqualTo: (id)  object 

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

Parameters
keyThe key to be constrained.
objectThe object that must not be equalled.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKey: (NSString *)  key
withinGeoBoxFromSouthwest: (PFGeoPoint *)  southwest
toNortheast: (PFGeoPoint *)  northeast 

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.

Parameters
keyThe key to be constrained.
southwestThe lower-left inclusive corner of the box.
northeastThe upper-right inclusive corner of the box.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKeyDoesNotExist: (NSString *)  key

Add a constraint that requires a key not exist.

Parameters
keyThe key that should not exist.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.
- (instancetype) whereKeyExists: (NSString *)  key

Add a constraint that requires a particular key exists.

Parameters
keyThe key that should exist.
Returns
The same instance of PFQuery as the receiver. This allows method chaining.

Property Documentation

- (PFCachePolicy) cachePolicy
readwritenonatomicassign



The cache policy to use for requests.

Not allowed when Pinning is enabled.

See also
- fromLocalDatastore
- fromPin
- fromPinWithName:
- (BOOL) hasCachedResult
readnonatomicassign

Returns whether there is a cached result for this query.

Returns
YES if there is a cached result for this query, otherwise NO.
- (NSInteger) limit
readwritenonatomicassign



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.

Warning
If you are calling findObjects with limit = 1, you may find it easier to use getFirst instead.
- (NSTimeInterval) maxCacheAge
readwritenonatomicassign

The age after which a cached value will be ignored

- (NSString*) parseClassName
readwritenonatomicstrong

The class name to query for.

- (NSInteger) skip
readwritenonatomicassign

The number of objects to skip before returning any.

- (BOOL) trace
readwritenonatomicassign



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

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

The documentation for this class was generated from the following files: