Inherits from NSObject
Declared in PFObject.h

Overview

A Parse Framework Object that is a local representation of data persisted to the Parse cloud.
This is the main class that is used to interact with objects in your app.

Subclassing Notes

Developers can subclass PFObject for a more native object-oriented class structure. Strongly-typed subclasses of PFObject must conform to the PFSubclassing protocol and must call registerSubclass to be returned by PFQuery and other PFObject factories. All methods in PFSubclassing except for [PFSubclassing parseClassName] are already implemented in the PFObject(Subclass) category. Inculding PFObject+Subclass.h in your implementation file provides these implementations automatically.

Subclasses support simpler initializers, query syntax, and dynamic synthesizers. The following shows an example subclass:

 @interface MYGame : PFObject< PFSubclassing >  
 // Accessing this property is the same as objectForKey:@"title"  
 @property (retain) NSString *title;  
 + (NSString *)parseClassName;  
 @end  

 @implementation MYGame  
 @dynamic title;  
 + (NSString *)parseClassName {  
     return @"Game";  
 }  
 @end  

 MYGame *game = [[MYGame alloc] init];  
 game.title = @"Bughouse";  
 [game saveInBackground];

Tasks

Creating a PFObject

Managing Object Properties

Saving an Object to Parse

Saving Many Objects to Parse

Delete Many Objects from Parse

Getting an Object from Parse

Getting Many Objects from Parse

Removing an Object from Parse

Subclass Methods

  • – init

    Designated initializer for subclasses.
    This method can only be called on subclasses which conform to PFSubclassing.
    This method should not be overridden.

  • + object

    Creates an instance of the registered subclass with this class’s parseClassName.
    This helps a subclass ensure that it can be subclassed itself. For example, [PFUser object] will
    return a MyUser object if MyUser is a registered subclass of PFUser. For this reason, [MyClass object] is
    preferred to [[MyClass alloc] init].
    This method can only be called on subclasses which conform to PFSubclassing.
    A default implementation is provided by PFObject which should always be sufficient.

  • + objectWithoutDataWithObjectId:

    Creates a reference to an existing PFObject for use in creating associations between PFObjects. Calling isDataAvailable on this
    object will return NO until fetchIfNeeded or refresh has been called. No network request will be made.
    This method can only be called on subclasses which conform to PFSubclassing.
    A default implementation is provided by PFObject which should always be sufficient.

  • + registerSubclass

    Registers an Objective-C class for Parse to use for representing a given Parse class.
    Once this is called on a PFObject subclass, any PFObject Parse creates with a class
    name matching [self parseClassName] will be an instance of subclass.
    This method can only be called on subclasses which conform to PFSubclassing.
    A default implementation is provided by PFObject which should always be sufficient.

  • + query

    Returns a query for objects of type parseClassName.
    This method can only be called on subclasses which conform to PFSubclassing.
    A default implementation is provided by PFObject which should always be sufficient.

Properties

ACL

The ACL for this object.

@property (nonatomic, retain) PFACL *ACL

Discussion

The ACL for this object.

Declared In

PFObject.h

createdAt

When the object was created.

@property (nonatomic, retain, readonly) NSDate *createdAt

Discussion

When the object was created.

Declared In

PFObject.h

objectId

The id of the object.

@property (nonatomic, retain) NSString *objectId

Discussion

The id of the object.

Declared In

PFObject.h

parseClassName

The class name of the object.

@property (readonly) NSString *parseClassName

Discussion

The class name of the object.

Declared In

PFObject.h

updatedAt

When the object was last updated.

@property (nonatomic, retain, readonly) NSDate *updatedAt

Discussion

When the object was last updated.

Declared In

PFObject.h

Class Methods

deleteAll:

Deletes a collection of objects all at once.

+ (BOOL)deleteAll:(NSArray *)objects

Parameters

objects

The array of objects to delete.

Return Value

Returns whether the delete succeeded.

Discussion

Deletes a collection of objects all at once.

Declared In

PFObject.h

deleteAll:error:

Deletes a collection of objects all at once and sets an error if necessary.

+ (BOOL)deleteAll:(NSArray *)objects error:(NSError **)error

Parameters

objects

The array of objects to delete.

error

Pointer to an NSError that will be set if necessary.

Return Value

Returns whether the delete succeeded.

Discussion

Deletes a collection of objects all at once and sets an error if necessary.

Declared In

PFObject.h

deleteAllInBackground:

Deletes a collection of objects all at once asynchronously.

+ (void)deleteAllInBackground:(NSArray *)objects

Parameters

objects

The array of objects to delete.

Discussion

Deletes a collection of objects all at once asynchronously.

Declared In

PFObject.h

deleteAllInBackground:block:

Deletes a collection of objects all at once asynchronously and the block when done.

+ (void)deleteAllInBackground:(NSArray *)objects block:(PFBooleanResultBlock)block

Parameters

objects

The array of objects to delete.

block

The block to execute. The block should have the following argument signature: (BOOL succeeded, NSError *error)

Discussion

Deletes a collection of objects all at once asynchronously and the block when done.

Declared In

PFObject.h

deleteAllInBackground:target:selector:

Deletes a collection of objects all at once asynchronously and calls a callback when done.

+ (void)deleteAllInBackground:(NSArray *)objects target:(id)target selector:(SEL)selector

Parameters

objects

The array of objects to delete.

target

The object to call selector on.

selector

The selector to call. It should have the following signature: (void)callbackWithError:(NSError *)error. error will be nil on success and set if there was an error.

Discussion

Deletes a collection of objects all at once asynchronously and calls a callback when done.

Declared In

PFObject.h

fetchAll:

Fetches all of the PFObjects with the current data from the server

+ (void)fetchAll:(NSArray *)objects

Parameters

objects

The list of objects to fetch.

Discussion

Fetches all of the PFObjects with the current data from the server

Declared In

PFObject.h

fetchAll:error:

Fetches all of the PFObjects with the current data from the server and sets an error if it occurs.

+ (void)fetchAll:(NSArray *)objects error:(NSError **)error

Parameters

objects

The list of objects to fetch.

error

Pointer to an NSError that will be set if necessary

Discussion

Fetches all of the PFObjects with the current data from the server and sets an error if it occurs.

Declared In

PFObject.h

fetchAllIfNeeded:

Fetches all of the PFObjects with the current data from the server

+ (void)fetchAllIfNeeded:(NSArray *)objects

Parameters

objects

The list of objects to fetch.

Discussion

Fetches all of the PFObjects with the current data from the server

Declared In

PFObject.h

fetchAllIfNeeded:error:

Fetches all of the PFObjects with the current data from the server and sets an error if it occurs.

+ (void)fetchAllIfNeeded:(NSArray *)objects error:(NSError **)error

Parameters

objects

The list of objects to fetch.

error

Pointer to an NSError that will be set if necessary

Discussion

Fetches all of the PFObjects with the current data from the server and sets an error if it occurs.

Declared In

PFObject.h

fetchAllIfNeededInBackground:block:

Fetches all of the PFObjects with the current data from the server asynchronously and calls the given block.

+ (void)fetchAllIfNeededInBackground:(NSArray *)objects block:(PFArrayResultBlock)block

Parameters

objects

The list of objects to fetch.

block

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

Discussion

Fetches all of the PFObjects with the current data from the server asynchronously and calls the given block.

Declared In

PFObject.h

fetchAllIfNeededInBackground:target:selector:

Fetches all of the PFObjects with the current data from the server asynchronously and calls the given callback.

+ (void)fetchAllIfNeededInBackground:(NSArray *)objects target:(id)target selector:(SEL)selector

Parameters

objects

The list of objects to fetch.

target

The target on which the selector will be called.

selector

The selector to call. It should have the following signature: (void)callbackWithResult:(NSArray )fetchedObjects error:(NSError )error. error will be nil on success and set if there was an error. fetchedObjects will the array of PFObjects
that were fetched.

Discussion

Fetches all of the PFObjects with the current data from the server asynchronously and calls the given callback.

Declared In

PFObject.h

fetchAllInBackground:block:

Fetches all of the PFObjects with the current data from the server asynchronously and calls the given block.

+ (void)fetchAllInBackground:(NSArray *)objects block:(PFArrayResultBlock)block

Parameters

objects

The list of objects to fetch.

block

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

Discussion

Fetches all of the PFObjects with the current data from the server asynchronously and calls the given block.

Declared In

PFObject.h

fetchAllInBackground:target:selector:

Fetches all of the PFObjects with the current data from the server asynchronously and calls the given callback.

+ (void)fetchAllInBackground:(NSArray *)objects target:(id)target selector:(SEL)selector

Parameters

objects

The list of objects to fetch.

target

The target on which the selector will be called.

selector

The selector to call. It should have the following signature: (void)callbackWithResult:(NSArray )fetchedObjects error:(NSError )error. error will be nil on success and set if there was an error. fetchedObjects will the array of PFObjects that were fetched.

Discussion

Fetches all of the PFObjects with the current data from the server asynchronously and calls the given callback.

Declared In

PFObject.h

object

Creates an instance of the registered subclass with this class’s parseClassName.
This helps a subclass ensure that it can be subclassed itself. For example, [PFUser object] will
return a MyUser object if MyUser is a registered subclass of PFUser. For this reason, [MyClass object] is
preferred to [[MyClass alloc] init].
This method can only be called on subclasses which conform to PFSubclassing.
A default implementation is provided by PFObject which should always be sufficient.

+ (instancetype)object

Discussion

Creates an instance of the registered subclass with this class’s parseClassName.
This helps a subclass ensure that it can be subclassed itself. For example, [PFUser object] will
return a MyUser object if MyUser is a registered subclass of PFUser. For this reason, [MyClass object] is
preferred to [[MyClass alloc] init].
This method can only be called on subclasses which conform to PFSubclassing.
A default implementation is provided by PFObject which should always be sufficient.

Declared In

PFObject+Subclass.h

objectWithClassName:

Creates a new PFObject with a class name.

+ (instancetype)objectWithClassName:(NSString *)className

Parameters

className

A class name can be any alphanumeric string that begins with a letter. It represents an object in your app, like a User of a Document.

Return Value

Returns the object that is instantiated with the given class name.

Discussion

Creates a new PFObject with a class name.

Declared In

PFObject.h

objectWithClassName:dictionary:

Creates a new PFObject with a class name, initialized with data constructed from the specified set of objects and keys.

+ (PFObject *)objectWithClassName:(NSString *)className dictionary:(NSDictionary *)dictionary

Parameters

className

The object’s class.

dictionary

An NSDictionary of keys and objects to set on the new PFObject.

Return Value

A PFObject with the given class name and set with the given data.

Discussion

Creates a new PFObject with a class name, initialized with data constructed from the specified set of objects and keys.

Declared In

PFObject.h

objectWithoutDataWithClassName:objectId:

Creates a reference to an existing PFObject for use in creating associations between PFObjects. Calling isDataAvailable on this
object will return NO until fetchIfNeeded or refresh has been called. No network request will be made.

+ (instancetype)objectWithoutDataWithClassName:(NSString *)className objectId:(NSString *)objectId

Parameters

className

The object’s class.

objectId

The object id for the referenced object.

Return Value

A PFObject without data.

Discussion

Creates a reference to an existing PFObject for use in creating associations between PFObjects. Calling isDataAvailable on this
object will return NO until fetchIfNeeded or refresh has been called. No network request will be made.

Declared In

PFObject.h

objectWithoutDataWithObjectId:

Creates a reference to an existing PFObject for use in creating associations between PFObjects. Calling isDataAvailable on this
object will return NO until fetchIfNeeded or refresh has been called. No network request will be made.
This method can only be called on subclasses which conform to PFSubclassing.
A default implementation is provided by PFObject which should always be sufficient.

+ (id)objectWithoutDataWithObjectId:(NSString *)objectId

Parameters

objectId

The object id for the referenced object.

Return Value

A PFObject without data.

Discussion

Creates a reference to an existing PFObject for use in creating associations between PFObjects. Calling isDataAvailable on this
object will return NO until fetchIfNeeded or refresh has been called. No network request will be made.
This method can only be called on subclasses which conform to PFSubclassing.
A default implementation is provided by PFObject which should always be sufficient.

Declared In

PFObject+Subclass.h

query

Returns a query for objects of type parseClassName.
This method can only be called on subclasses which conform to PFSubclassing.
A default implementation is provided by PFObject which should always be sufficient.

+ (PFQuery *)query

Discussion

Returns a query for objects of type parseClassName.
This method can only be called on subclasses which conform to PFSubclassing.
A default implementation is provided by PFObject which should always be sufficient.

Declared In

PFObject+Subclass.h

registerSubclass

Registers an Objective-C class for Parse to use for representing a given Parse class.
Once this is called on a PFObject subclass, any PFObject Parse creates with a class
name matching [self parseClassName] will be an instance of subclass.
This method can only be called on subclasses which conform to PFSubclassing.
A default implementation is provided by PFObject which should always be sufficient.

+ (void)registerSubclass

Discussion

Registers an Objective-C class for Parse to use for representing a given Parse class.
Once this is called on a PFObject subclass, any PFObject Parse creates with a class
name matching [self parseClassName] will be an instance of subclass.
This method can only be called on subclasses which conform to PFSubclassing.
A default implementation is provided by PFObject which should always be sufficient.

Declared In

PFObject+Subclass.h

saveAll:

Saves a collection of objects all at once.

+ (BOOL)saveAll:(NSArray *)objects

Parameters

objects

The array of objects to save.

Return Value

Returns whether the save succeeded.

Discussion

Saves a collection of objects all at once.

Declared In

PFObject.h

saveAll:error:

Saves a collection of objects all at once and sets an error if necessary.

+ (BOOL)saveAll:(NSArray *)objects error:(NSError **)error

Parameters

objects

The array of objects to save.

error

Pointer to an NSError that will be set if necessary.

Return Value

Returns whether the save succeeded.

Discussion

Saves a collection of objects all at once and sets an error if necessary.

Declared In

PFObject.h

saveAllInBackground:

Saves a collection of objects all at once asynchronously.

+ (void)saveAllInBackground:(NSArray *)objects

Parameters

objects

The array of objects to save.

Discussion

Saves a collection of objects all at once asynchronously.

Declared In

PFObject.h

saveAllInBackground:block:

Saves a collection of objects all at once asynchronously and the block when done.

+ (void)saveAllInBackground:(NSArray *)objects block:(PFBooleanResultBlock)block

Parameters

objects

The array of objects to save.

block

The block to execute. The block should have the following argument signature: (BOOL succeeded, NSError *error)

Discussion

Saves a collection of objects all at once asynchronously and the block when done.

Declared In

PFObject.h

saveAllInBackground:target:selector:

Saves a collection of objects all at once asynchronously and calls a callback when done.

+ (void)saveAllInBackground:(NSArray *)objects target:(id)target selector:(SEL)selector

Parameters

objects

The array of objects to save.

target

The object to call selector on.

selector

The selector to call. It should have the following signature: (void)callbackWithError:(NSError *)error. error will be nil on success and set if there was an error.

Discussion

Saves a collection of objects all at once asynchronously and calls a callback when done.

Declared In

PFObject.h

Instance Methods

addObject:forKey:

Adds an object to the end of the array associated with a given key.

- (void)addObject:(id)object forKey:(NSString *)key

Parameters

object

The object to add.

key

The key.

Discussion

Adds an object to the end of the array associated with a given key.

Declared In

PFObject.h

addObjectsFromArray:forKey:

Adds the objects contained in another array to the end of the array associated
with a given key.

- (void)addObjectsFromArray:(NSArray *)objects forKey:(NSString *)key

Parameters

objects

The array of objects to add.

key

The key.

Discussion

Adds the objects contained in another array to the end of the array associated
with a given key.

Declared In

PFObject.h

addUniqueObject:forKey:

Adds an object to the array associated with a given key, only if it is not
already present in the array. The position of the insert is not guaranteed.

- (void)addUniqueObject:(id)object forKey:(NSString *)key

Parameters

object

The object to add.

key

The key.

Discussion

Adds an object to the array associated with a given key, only if it is not
already present in the array. The position of the insert is not guaranteed.

Declared In

PFObject.h

addUniqueObjectsFromArray:forKey:

Adds the objects contained in another array to the array associated with
a given key, only adding elements which are not already present in the array.
The position of the insert is not guaranteed.

- (void)addUniqueObjectsFromArray:(NSArray *)objects forKey:(NSString *)key

Parameters

objects

The array of objects to add.

key

The key.

Discussion

Adds the objects contained in another array to the array associated with
a given key, only adding elements which are not already present in the array.
The position of the insert is not guaranteed.

Declared In

PFObject.h

allKeys

Returns an array of the keys contained in this object. This does not include
createdAt, updatedAt, authData, or objectId. It does include things like username
and ACL.

- (NSArray *)allKeys

Discussion

Returns an array of the keys contained in this object. This does not include
createdAt, updatedAt, authData, or objectId. It does include things like username
and ACL.

Declared In

PFObject.h

delete

Deletes the PFObject.

- (BOOL)delete

Return Value

Returns whether the delete succeeded.

Discussion

Deletes the PFObject.

Declared In

PFObject.h

delete:

Deletes the PFObject and sets an error if it occurs.

- (BOOL)delete:(NSError **)error

Parameters

error

Pointer to an NSError that will be set if necessary.

Return Value

Returns whether the delete succeeded.

Discussion

Deletes the PFObject and sets an error if it occurs.

Declared In

PFObject.h

deleteEventually

Deletes this object from the server at some unspecified time in the future, even if Parse is currently inaccessible.
Use this when you may not have a solid network connection, and don’t need to know when the delete completes.
If there is some problem with the object such that it can’t be deleted, the request will be silently discarded.

- (void)deleteEventually

Discussion

Deletes this object from the server at some unspecified time in the future, even if Parse is currently inaccessible.
Use this when you may not have a solid network connection, and don’t need to know when the delete completes.
If there is some problem with the object such that it can’t be deleted, the request will be silently discarded.

Delete instructions made with this method will be stored locally in an on-disk cache until they can be transmitted
to Parse. They will be sent immediately if possible. Otherwise, they will be sent the next time a network connection
is available. Delete requests will persist even after the app is closed, in which case they will be sent the
next time the app is opened. If more than 10MB of saveEventually or deleteEventually commands are waiting to be sent,
subsequent calls to saveEventually or deleteEventually will cause old requests to be silently discarded until the
connection can be re-established, and the queued requests can go through.

Declared In

PFObject.h

deleteInBackground

Deletes the PFObject asynchronously.

- (void)deleteInBackground

Discussion

Deletes the PFObject asynchronously.

Declared In

PFObject.h

deleteInBackgroundWithBlock:

Deletes the PFObject asynchronously and executes the given callback block.

- (void)deleteInBackgroundWithBlock:(PFBooleanResultBlock)block

Parameters

block

The block to execute. The block should have the following argument signature: (BOOL succeeded, NSError *error)

Discussion

Deletes the PFObject asynchronously and executes the given callback block.

Declared In

PFObject.h

deleteInBackgroundWithTarget:selector:

Deletes the PFObject asynchronously and calls the given callback.

- (void)deleteInBackgroundWithTarget:(id)target selector:(SEL)selector

Parameters

target

The object to call selector on.

selector

The selector to call. It should have the following signature: (void)callbackWithResult:(NSNumber )result error:(NSError )error. error will be nil on success and set if there was an error. [result boolValue] will tell you whether the call succeeded or not.

Discussion

Deletes the PFObject asynchronously and calls the given callback.

Declared In

PFObject.h

fetch

Fetches the PFObject with the current data from the server.

- (void)fetch

Discussion

Fetches the PFObject with the current data from the server.

Declared In

PFObject.h

fetch:

Fetches the PFObject with the current data from the server and sets an error if it occurs.

- (void)fetch:(NSError **)error

Parameters

error

Pointer to an NSError that will be set if necessary.

Discussion

Fetches the PFObject with the current data from the server and sets an error if it occurs.

Declared In

PFObject.h

fetchIfNeeded

Fetches the PFObject’s data from the server if isDataAvailable is false.

- (PFObject *)fetchIfNeeded

Discussion

Fetches the PFObject’s data from the server if isDataAvailable is false.

Declared In

PFObject.h

fetchIfNeeded:

Fetches the PFObject’s data from the server if isDataAvailable is false.

- (PFObject *)fetchIfNeeded:(NSError **)error

Parameters

error

Pointer to an NSError that will be set if necessary.

Discussion

Fetches the PFObject’s data from the server if isDataAvailable is false.

Declared In

PFObject.h

fetchIfNeededInBackgroundWithBlock:

Fetches the PFObject’s data asynchronously if isDataAvailable is false, then calls the callback block.

- (void)fetchIfNeededInBackgroundWithBlock:(PFObjectResultBlock)block

Parameters

block

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

Discussion

Fetches the PFObject’s data asynchronously if isDataAvailable is false, then calls the callback block.

Declared In

PFObject.h

fetchIfNeededInBackgroundWithTarget:selector:

Fetches the PFObject’s data asynchronously if isDataAvailable is false, then calls the callback.

- (void)fetchIfNeededInBackgroundWithTarget:(id)target selector:(SEL)selector

Parameters

target

The target on which the selector will be called.

selector

The selector to call. It should have the following signature: (void)callbackWithResult:(PFObject )fetchedObject error:(NSError )error. error will be nil on success and set if there was an error.

Discussion

Fetches the PFObject’s data asynchronously if isDataAvailable is false, then calls the callback.

Declared In

PFObject.h

fetchInBackgroundWithBlock:

Fetches the PFObject asynchronously and executes the given callback block.

- (void)fetchInBackgroundWithBlock:(PFObjectResultBlock)block

Parameters

block

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

Discussion

Fetches the PFObject asynchronously and executes the given callback block.

Declared In

PFObject.h

fetchInBackgroundWithTarget:selector:

Fetches the PFObject asynchronously and calls the given callback.

- (void)fetchInBackgroundWithTarget:(id)target selector:(SEL)selector

Parameters

target

The target on which the selector will be called.

selector

The selector to call. It should have the following signature: (void)callbackWithResult:(PFObject )refreshedObject error:(NSError )error. error will be nil on success and set if there was an error. refreshedObject will be the PFObject with the refreshed data.

Discussion

Fetches the PFObject asynchronously and calls the given callback.

Declared In

PFObject.h

incrementKey:

Increments the given key by 1.

- (void)incrementKey:(NSString *)key

Parameters

key

The key.

Discussion

Increments the given key by 1.

Declared In

PFObject.h

incrementKey:byAmount:

Increments the given key by a number.

- (void)incrementKey:(NSString *)key byAmount:(NSNumber *)amount

Parameters

key

The key.

amount

The amount to increment.

Discussion

Increments the given key by a number.

Declared In

PFObject.h

init

Designated initializer for subclasses.
This method can only be called on subclasses which conform to PFSubclassing.
This method should not be overridden.

- (id)init

Discussion

Designated initializer for subclasses.
This method can only be called on subclasses which conform to PFSubclassing.
This method should not be overridden.

Declared In

PFObject+Subclass.h

initWithClassName:

Initializes a new PFObject with a class name.

- (id)initWithClassName:(NSString *)newClassName

Parameters

newClassName

A class name can be any alphanumeric string that begins with a letter. It represents an object in your app, like a User or a Document.

Return Value

Returns the object that is instantiated with the given class name.

Discussion

Initializes a new PFObject with a class name.

Declared In

PFObject.h

isDataAvailable

Gets whether the PFObject has been fetched.

- (BOOL)isDataAvailable

Return Value

YES if the PFObject is new or has been fetched or refreshed. NO otherwise.

Discussion

Gets whether the PFObject has been fetched.

Declared In

PFObject.h

isDirty

Gets whether any key-value pair in this object (or its children) has been added/updated/removed and not saved yet.

- (BOOL)isDirty

Return Value

Returns whether this object has been altered and not saved yet.

Discussion

Gets whether any key-value pair in this object (or its children) has been added/updated/removed and not saved yet.

Declared In

PFObject.h

isDirtyForKey:

Get whether a value associated with a key has been added/updated/removed and not saved yet.

- (BOOL)isDirtyForKey:(NSString *)key

Parameters

key

The key to check for

Return Value

Returns whether this key has been altered and not saved yet.

Discussion

Get whether a value associated with a key has been added/updated/removed and not saved yet.

Declared In

PFObject.h

objectForKey:

Returns the object associated with a given key.

- (id)objectForKey:(NSString *)key

Parameters

key

The key that the object is associated with.

Return Value

The value associated with the given key, or nil if no value is associated with key.

Discussion

Returns the object associated with a given key.

Declared In

PFObject.h

objectForKeyedSubscript:

  • In LLVM 4.0 (XCode 4.5) or higher allows myPFObject[key].
- (id)objectForKeyedSubscript:(NSString *)key

Parameters

key

The key.

Discussion

  • In LLVM 4.0 (XCode 4.5) or higher allows myPFObject[key].

Declared In

PFObject.h

refresh

Refreshes the PFObject with the current data from the server.

- (void)refresh

Discussion

Refreshes the PFObject with the current data from the server.

Declared In

PFObject.h

refresh:

Refreshes the PFObject with the current data from the server and sets an error if it occurs.

- (void)refresh:(NSError **)error

Parameters

error

Pointer to an NSError that will be set if necessary.

Discussion

Refreshes the PFObject with the current data from the server and sets an error if it occurs.

Declared In

PFObject.h

refreshInBackgroundWithBlock:

Refreshes the PFObject asynchronously and executes the given callback block.

- (void)refreshInBackgroundWithBlock:(PFObjectResultBlock)block

Parameters

block

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

Discussion

Refreshes the PFObject asynchronously and executes the given callback block.

Declared In

PFObject.h

refreshInBackgroundWithTarget:selector:

Refreshes the PFObject asynchronously and calls the given callback.

- (void)refreshInBackgroundWithTarget:(id)target selector:(SEL)selector

Parameters

target

The target on which the selector will be called.

selector

The selector to call. It should have the following signature: (void)callbackWithResult:(PFObject )refreshedObject error:(NSError )error. error will be nil on success and set if there was an error. refreshedObject will be the PFObject with the refreshed data.

Discussion

Refreshes the PFObject asynchronously and calls the given callback.

Declared In

PFObject.h

relationForKey:

Returns the relation object associated with the given key

- (PFRelation *)relationForKey:(NSString *)key

Parameters

key

The key that the relation is associated with.

Discussion

Returns the relation object associated with the given key

Declared In

PFObject.h

relationforKey:

Use relationForKey instead. This method exists only for backward compatibility.

- (PFRelation *)relationforKey:(NSString *)key

Discussion

Use relationForKey instead. This method exists only for backward compatibility.

Declared In

PFObject.h

removeObject:forKey:

Removes all occurrences of an object from the array associated with a given
key.

- (void)removeObject:(id)object forKey:(NSString *)key

Parameters

object

The object to remove.

key

The key.

Discussion

Removes all occurrences of an object from the array associated with a given
key.

Declared In

PFObject.h

removeObjectForKey:

Unsets a key on the object.

- (void)removeObjectForKey:(NSString *)key

Parameters

key

The key.

Discussion

Unsets a key on the object.

Declared In

PFObject.h

removeObjectsInArray:forKey:

Removes all occurrences of the objects contained in another array from the
array associated with a given key.

- (void)removeObjectsInArray:(NSArray *)objects forKey:(NSString *)key

Parameters

objects

The array of objects to remove.

key

The key.

Discussion

Removes all occurrences of the objects contained in another array from the
array associated with a given key.

Declared In

PFObject.h

save

Saves the PFObject.

- (BOOL)save

Return Value

Returns whether the save succeeded.

Discussion

Saves the PFObject.

Declared In

PFObject.h

save:

Saves the PFObject and sets an error if it occurs.

- (BOOL)save:(NSError **)error

Parameters

error

Pointer to an NSError that will be set if necessary.

Return Value

Returns whether the save succeeded.

Discussion

Saves the PFObject and sets an error if it occurs.

Declared In

PFObject.h

saveEventually

- (void)saveEventually

Declared In

PFObject.h

saveEventually:

Saves this object to the server at some unspecified time in the future, even if Parse is currently inaccessible.
Use this when you may not have a solid network connection, and don’t need to know when the save completes.
If there is some problem with the object such that it can’t be saved, it will be silently discarded. If the save
completes successfully while the object is still in memory, then callback will be called.

- (void)saveEventually:(PFBooleanResultBlock)callback

Discussion

Saves this object to the server at some unspecified time in the future, even if Parse is currently inaccessible.
Use this when you may not have a solid network connection, and don’t need to know when the save completes.
If there is some problem with the object such that it can’t be saved, it will be silently discarded. If the save
completes successfully while the object is still in memory, then callback will be called.

Objects saved with this method will be stored locally in an on-disk cache until they can be delivered to Parse.
They will be sent immediately if possible. Otherwise, they will be sent the next time a network connection is
available. Objects saved this way will persist even after the app is closed, in which case they will be sent the
next time the app is opened. If more than 10MB of data is waiting to be sent, subsequent calls to saveEventually
will cause old saves to be silently discarded until the connection can be re-established, and the queued objects
can be saved.

Declared In

PFObject.h

saveInBackground

Saves the PFObject asynchronously.

- (void)saveInBackground

Discussion

Saves the PFObject asynchronously.

Declared In

PFObject.h

saveInBackgroundWithBlock:

Saves the PFObject asynchronously and executes the given callback block.

- (void)saveInBackgroundWithBlock:(PFBooleanResultBlock)block

Parameters

block

The block to execute. The block should have the following argument signature: (BOOL succeeded, NSError *error)

Discussion

Saves the PFObject asynchronously and executes the given callback block.

Declared In

PFObject.h

saveInBackgroundWithTarget:selector:

Saves the PFObject asynchronously and calls the given callback.

- (void)saveInBackgroundWithTarget:(id)target selector:(SEL)selector

Parameters

target

The object to call selector on.

selector

The selector to call. It should have the following signature: (void)callbackWithResult:(NSNumber )result error:(NSError )error. error will be nil on success and set if there was an error. [result boolValue] will tell you whether the call succeeded or not.

Discussion

Saves the PFObject asynchronously and calls the given callback.

Declared In

PFObject.h

setObject:forKey:

Sets the object associated with a given key.

- (void)setObject:(id)object forKey:(NSString *)key

Parameters

object

The object.

key

The key.

Discussion

Sets the object associated with a given key.

Declared In

PFObject.h

setObject:forKeyedSubscript:

  • In LLVM 4.0 (XCode 4.5) or higher allows myObject[key] = value
- (void)setObject:(id)object forKeyedSubscript:(NSString *)key

Parameters

object

The object.

key

The key.

Discussion

  • In LLVM 4.0 (XCode 4.5) or higher allows myObject[key] = value

Declared In

PFObject.h