PFObject

Objective-C


@interface PFObject : NSObject

Swift

class PFObject : NSObject

The PFObject class 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.

Creating a PFObject

  • Initializes a new empty PFObject instance with a class name.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithClassName:(nonnull NSString *)newClassName;

    Swift

    init(className newClassName: String)

    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.

  • Creates a new PFObject with a class name.

    Declaration

    Objective-C

    + (nonnull instancetype)objectWithClassName:(nonnull 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’ or a ‘Document’.

    Return Value

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

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

    Declaration

    Objective-C

    + (nonnull instancetype)
        objectWithClassName:(nonnull NSString *)className
                 dictionary:(nullable NSDictionary<NSString *, id> *)dictionary;

    Swift

    convenience init(className: String, dictionary: [String : Any]?)

    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.

  • Creates a reference to an existing PFObject for use in creating associations between PFObjects.

    Calling dataAvailable on this object will return NO until -fetchIfNeeded has been called. No network request will be made.

    Declaration

    Objective-C

    + (nonnull instancetype)
        objectWithoutDataWithClassName:(nonnull NSString *)className
                              objectId:(nullable NSString *)objectId;

    Swift

    convenience init(withoutDataWithClassName className: String, objectId: String?)

    Parameters

    className

    The object’s class.

    objectId

    The object id for the referenced object.

    Return Value

    A PFObject instance without data.

Managing Object Properties

  • The class name of the object.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly) NSString *_Nonnull parseClassName;

    Swift

    var parseClassName: String { get }
  • The id of the object.

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) NSString *objectId;

    Swift

    var objectId: String? { get set }
  • When the object was last updated.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) NSDate *updatedAt;

    Swift

    var updatedAt: Date? { get }
  • When the object was created.

    Declaration

    Objective-C

    @property (nonatomic, strong, readonly, nullable) NSDate *createdAt;

    Swift

    var createdAt: Date? { get }
  • ACL

    The ACL for this object.

    Declaration

    Objective-C

    @property (nonatomic, strong, nullable) PFACL *ACL;

    Swift

    var acl: PFACL? { get set }
  • 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.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly) NSArray<NSString *> *_Nonnull allKeys;

    Swift

    var allKeys: [String] { get }

Accessors

  • Returns the value associated with a given key.

    See

    -objectForKeyedSubscript:

    Declaration

    Objective-C

    - (nullable id)objectForKey:(nonnull NSString *)key;

    Swift

    func object(forKey key: String) -> Any?

    Parameters

    key

    The key for which to return the corresponding value.

  • Sets the object associated with a given key.

    See

    -setObject:forKeyedSubscript:

    Declaration

    Objective-C

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

    Swift

    func setObject(_ object: Any, forKey key: String)

    Parameters

    object

    The object for key. A strong reference to the object is maintained by PFObject. Raises an NSInvalidArgumentException if object is nil. If you need to represent a nil value - use NSNull.

    key

    The key for object. Raises an NSInvalidArgumentException if key is nil.

  • Unsets a key on the object.

    Declaration

    Objective-C

    - (void)removeObjectForKey:(nonnull NSString *)key;

    Swift

    func remove(forKey key: String)

    Parameters

    key

    The key.

  • Returns the value associated with a given key.

    This method enables usage of literal syntax on PFObject. E.g. NSString *value = object[@"key"];

    See

    -objectForKey:

    Declaration

    Objective-C

    - (nullable id)objectForKeyedSubscript:(nonnull NSString *)key;

    Swift

    subscript(key: String) -> Any! { get set }

    Parameters

    key

    The key for which to return the corresponding value.

  • Returns the value associated with a given key.

    This method enables usage of literal syntax on PFObject. E.g. object[@"key"] = @"value";

    See

    -setObject:forKey:

    Declaration

    Objective-C

    - (void)setObject:(nonnull id)object forKeyedSubscript:(nonnull NSString *)key;

    Parameters

    object

    The object for key. A strong reference to the object is maintained by PFObject. Raises an NSInvalidArgumentException if object is nil. If you need to represent a nil value - use NSNull.

    key

    The key for object. Raises an NSInvalidArgumentException if key is nil.

  • Returns the instance of PFRelation class associated with the given key.

    Declaration

    Objective-C

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

    Swift

    func relation(forKey key: String) -> PFRelation

    Parameters

    key

    The key that the relation is associated with.

  • Deprecated

    Please use -relationForKey: instead.

    Returns the instance of PFRelation class associated with the given key.

    @deprecated Please use PFObject.-relationForKey: instead.

    Declaration

    Objective-C

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

    Swift

    func relationforKey(_ key: String) -> PFRelation

    Parameters

    key

    The key that the relation is associated with.

  • Clears any changes to this object made since the last call to save and sets it back to the server state.

    Declaration

    Objective-C

    - (void)revert;

    Swift

    func revert()
  • Clears any changes to this object’s key that were done after last successful save and sets it back to the server state.

    Declaration

    Objective-C

    - (void)revertObjectForKey:(nonnull NSString *)key;

    Swift

    func revertObject(forKey key: String)

    Parameters

    key

    The key to revert changes for.

Array Accessors

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

    Declaration

    Objective-C

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

    Swift

    func add(_ object: Any, forKey key: String)

    Parameters

    object

    The object to add.

    key

    The key.

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

    Declaration

    Objective-C

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

    Swift

    func addObjects(from objects: [Any], forKey key: String)

    Parameters

    objects

    The array of objects to add.

    key

    The key.

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

    Declaration

    Objective-C

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

    Swift

    func addUniqueObject(_ object: Any, forKey key: String)

    Parameters

    object

    The object to add.

    key

    The key.

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

    @discussion The position of the insert is not guaranteed.

    Declaration

    Objective-C

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

    Swift

    func addUniqueObjects(from objects: [Any], forKey key: String)

    Parameters

    objects

    The array of objects to add.

    key

    The key.

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

    Declaration

    Objective-C

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

    Swift

    func remove(_ object: Any, forKey key: String)

    Parameters

    object

    The object to remove.

    key

    The key.

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

    Declaration

    Objective-C

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

    Swift

    func removeObjects(in objects: [Any], forKey key: String)

    Parameters

    objects

    The array of objects to remove.

    key

    The key.

Increment

  • Increments the given key by 1.

    Declaration

    Objective-C

    - (void)incrementKey:(nonnull NSString *)key;

    Swift

    func incrementKey(_ key: String)

    Parameters

    key

    The key.

  • Increments the given key by a number.

    Declaration

    Objective-C

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

    Swift

    func incrementKey(_ key: String, byAmount amount: NSNumber)

    Parameters

    key

    The key.

    amount

    The amount to increment.

Saving Objects

  • Saves the PFObject asynchronously.

    Declaration

    Objective-C

    - (id)saveInBackground;

    Swift

    func saveInBackground() -> Any!

    Return Value

    The task that encapsulates the work being done.

  • Saves the PFObject asynchronously and executes the given callback block.

    Declaration

    Objective-C

    - (void)saveInBackgroundWithBlock:(nullable PFBooleanResultBlock)block;

    Swift

    func saveInBackground() async throws -> Bool

    Parameters

    block

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

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

    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.

    Declaration

    Objective-C

    - (id)saveEventually;

    Swift

    func saveEventually() -> Any!

    Return Value

    The task that encapsulates the work being done.

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

    Declaration

    Objective-C

    - (void)saveEventually:(nullable PFBooleanResultBlock)callback;

    Swift

    func saveEventually(_ callback: PFBooleanResultBlock? = nil)

    Parameters

    callback

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

Saving Many Objects

  • Saves a collection of objects all at once asynchronously.

    Declaration

    Objective-C

    + (id)saveAllInBackground:(nullable NSArray<PFObject *> *)objects;

    Swift

    class func saveAll(inBackground objects: [PFObject]?) -> Any!

    Parameters

    objects

    The array of objects to save.

    Return Value

    The task that encapsulates the work being done.

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

    Declaration

    Objective-C

    + (void)saveAllInBackground:(nullable NSArray<PFObject *> *)objects
                          block:(nullable PFBooleanResultBlock)block;

    Swift

    class func saveAll(inBackground objects: [PFObject]?, block: PFBooleanResultBlock? = nil)

    Parameters

    objects

    The array of objects to save.

    block

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

Deleting Many Objects

  • Deletes a collection of objects all at once asynchronously.

    Declaration

    Objective-C

    + (id)deleteAllInBackground:(nullable NSArray<PFObject *> *)objects;

    Swift

    class func deleteAll(inBackground objects: [PFObject]?) -> Any!

    Parameters

    objects

    The array of objects to delete.

    Return Value

    The task that encapsulates the work being done.

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

    Declaration

    Objective-C

    + (void)deleteAllInBackground:(nullable NSArray<PFObject *> *)objects
                            block:(nullable PFBooleanResultBlock)block;

    Swift

    class func deleteAll(inBackground objects: [PFObject]?, block: PFBooleanResultBlock? = nil)

    Parameters

    objects

    The array of objects to delete.

    block

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

Getting an Object

  • Gets whether the PFObject has been fetched.

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readonly,
              getter=isDataAvailable) BOOL dataAvailable;

    Swift

    var isDataAvailable: Bool { get }

    Return Value

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

  • Checks whether the PFObject has data for given key

    Declaration

    Objective-C

    - (BOOL)isDataAvailableForKey:(nonnull NSString *)key;

    Swift

    func isDataAvailable(forKey key: String) -> Bool

    Return Value

    YES if data is available for given key

  • Fetches the PFObject asynchronously and sets it as a result for the task.

    Declaration

    Objective-C

    - (id)fetchInBackground;

    Swift

    func fetchInBackground() -> Any!

    Return Value

    The task that encapsulates the work being done.

  • Fetches the PFObject asynchronously and executes the given callback block.

    Declaration

    Objective-C

    - (void)fetchInBackgroundWithBlock:(nullable PFObjectResultBlock)block;

    Swift

    func fetchInBackground() async throws -> PFObject

    Parameters

    block

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

  • Fetches the PFObject data asynchronously if dataAvailable is NO, then sets it as a result for the task.

    Declaration

    Objective-C

    - (id)fetchIfNeededInBackground;

    Swift

    func fetchIfNeededInBackground() -> Any!

    Return Value

    The task that encapsulates the work being done.

  • Fetches the PFObject data asynchronously if dataAvailable is NO, then calls the callback block.

    Declaration

    Objective-C

    - (void)fetchIfNeededInBackgroundWithBlock:(nullable PFObjectResultBlock)block;

    Swift

    func fetchIfNeededInBackground() async throws -> PFObject

    Parameters

    block

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

Getting Many Objects

  • Fetches all of the PFObject objects with the current data from the server asynchronously.

    Declaration

    Objective-C

    + (id)fetchAllInBackground:(nullable NSArray<PFObject *> *)objects;

    Swift

    class func fetchAll(inBackground objects: [PFObject]?) -> Any!

    Parameters

    objects

    The list of objects to fetch.

    Return Value

    The task that encapsulates the work being done.

  • Fetches all of the PFObject objects with the current data from the server asynchronously and calls the given block.

    Declaration

    Objective-C

    + (void)fetchAllInBackground:(nullable NSArray<PFObject *> *)objects
                           block:(nullable PFArrayResultBlock)block;

    Swift

    class func fetchAll(inBackground objects: [PFObject]?, block: PFArrayResultBlock? = nil)

    Parameters

    objects

    The list of objects to fetch.

    block

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

  • Fetches all of the PFObject objects with the current data from the server asynchronously.

    Declaration

    Objective-C

    + (id)fetchAllIfNeededInBackground:(nullable NSArray<PFObject *> *)objects;

    Swift

    class func fetchAllIfNeeded(inBackground objects: [PFObject]?) -> Any!

    Parameters

    objects

    The list of objects to fetch.

    Return Value

    The task that encapsulates the work being done.

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

    Declaration

    Objective-C

    + (void)fetchAllIfNeededInBackground:(nullable NSArray<PFObject *> *)objects
                                   block:(nullable PFArrayResultBlock)block;

    Swift

    class func fetchAllIfNeeded(inBackground objects: [PFObject]?, block: PFArrayResultBlock? = nil)

    Parameters

    objects

    The list of objects to fetch.

    block

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

Fetching From Local Datastore

  • Asynchronously loads data from the local datastore into this object, if it has not been fetched from the server already.

    Declaration

    Objective-C

    - (id)fetchFromLocalDatastoreInBackground;

    Swift

    func fetchFromLocalDatastoreInBackground() -> Any!

    Return Value

    The task that encapsulates the work being done.

  • Asynchronously loads data from the local datastore into this object, if it has not been fetched from the server already.

    Declaration

    Objective-C

    - (void)fetchFromLocalDatastoreInBackgroundWithBlock:
        (nullable PFObjectResultBlock)block;

    Swift

    func fetchFromLocalDatastoreInBackground() async throws -> PFObject

    Parameters

    block

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

Deleting an Object

  • Deletes the PFObject asynchronously.

    Declaration

    Objective-C

    - (id)deleteInBackground;

    Swift

    func deleteInBackground() -> Any!

    Return Value

    The task that encapsulates the work being done.

  • Deletes the PFObject asynchronously and executes the given callback block.

    Declaration

    Objective-C

    - (void)deleteInBackgroundWithBlock:(nullable PFBooleanResultBlock)block;

    Swift

    func deleteInBackground() async throws -> Bool

    Parameters

    block

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

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

    Declaration

    Objective-C

    - (id)deleteEventually;

    Swift

    func deleteEventually() -> Any!

    Return Value

    The task that encapsulates the work being done.

Dirtiness

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

    Declaration

    Objective-C

    @property (nonatomic, readonly, getter=isDirty) BOOL dirty;

    Swift

    var isDirty: Bool { get }

    Return Value

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

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

    Declaration

    Objective-C

    - (BOOL)isDirtyForKey:(nonnull NSString *)key;

    Swift

    func isDirty(forKey key: String) -> Bool

    Parameters

    key

    The key to check for

    Return Value

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

Pinning

  • Asynchronously stores the object and every object it points to in the local datastore, recursively, using a default pin name: PFObjectDefaultPin.

    If those other objects have not been fetched from Parse, they will not be stored. However, if they have changed data, all the changes will be retained. To get the objects back later, you can use a PFQuery that uses PFQuery., or you can create an unfetched pointer with +objectWithoutDataWithClassName:objectId: and then call -fetchFromLocalDatastore on it.

    Declaration

    Objective-C

    - (id)pinInBackground;

    Swift

    func pinInBackground() -> Any!

    Return Value

    The task that encapsulates the work being done.

  • Asynchronously stores the object and every object it points to in the local datastore, recursively, using a default pin name: PFObjectDefaultPin.

    If those other objects have not been fetched from Parse, they will not be stored. However, if they have changed data, all the changes will be retained. To get the objects back later, you can use a PFQuery that uses PFQuery., or you can create an unfetched pointer with +objectWithoutDataWithClassName:objectId: and then call -fetchFromLocalDatastore on it.

    Declaration

    Objective-C

    - (void)pinInBackgroundWithBlock:(nullable PFBooleanResultBlock)block;

    Swift

    func pinInBackground() async throws -> Bool

    Parameters

    block

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

  • Asynchronously stores the object and every object it points to in the local datastore, recursively.

    If those other objects have not been fetched from Parse, they will not be stored. However, if they have changed data, all the changes will be retained. To get the objects back later, you can use a PFQuery that uses PFQuery., or you can create an unfetched pointer with +objectWithoutDataWithClassName:objectId: and then call `-fetchFromLocalDatastore on it.

    See

    unpinInBackgroundWithName:

    Declaration

    Objective-C

    - (id)pinInBackgroundWithName:(nonnull NSString *)name;

    Swift

    func pinInBackground(withName name: String) -> Any!

    Parameters

    name

    The name of the pin.

    Return Value

    The task that encapsulates the work being done.

  • Asynchronously stores the object and every object it points to in the local datastore, recursively.

    If those other objects have not been fetched from Parse, they will not be stored. However, if they have changed data, all the changes will be retained. To get the objects back later, you can use a PFQuery that uses PFQuery., or you can create an unfetched pointer with +objectWithoutDataWithClassName:objectId: and then call -fetchFromLocalDatastore on it.

    See

    unpinInBackgroundWithName:block:

    Declaration

    Objective-C

    - (void)pinInBackgroundWithName:(nonnull NSString *)name
                              block:(nullable PFBooleanResultBlock)block;

    Swift

    func pinInBackground(withName name: String, block: PFBooleanResultBlock? = nil)

    Parameters

    name

    The name of the pin.

    block

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

Pinning Many Objects

  • Asynchronously stores the objects and every object they point to in the local datastore, recursively, using a default pin name: PFObjectDefaultPin.

    If those other objects have not been fetched from Parse, they will not be stored. However, if they have changed data, all the changes will be retained. To get the objects back later, you can use a PFQuery that uses PFQuery., or you can create an unfetched pointer with +objectWithoutDataWithClassName:objectId: and then call fetchFromLocalDatastore: on it.

    See

    unpinAllInBackground:

    See

    PFObjectDefaultPin

    Declaration

    Objective-C

    + (id)pinAllInBackground:(nullable NSArray<PFObject *> *)objects;

    Swift

    class func pinAll(inBackground objects: [PFObject]?) -> Any!

    Parameters

    objects

    The objects to be pinned.

    Return Value

    The task that encapsulates the work being done.

  • Asynchronously stores the objects and every object they point to in the local datastore, recursively, using a default pin name: PFObjectDefaultPin.

    If those other objects have not been fetched from Parse, they will not be stored. However, if they have changed data, all the changes will be retained. To get the objects back later, you can use a PFQuery that uses PFQuery., or you can create an unfetched pointer with +objectWithoutDataWithClassName:objectId: and then call fetchFromLocalDatastore: on it.

    See

    unpinAllInBackground:block:

    See

    PFObjectDefaultPin

    Declaration

    Objective-C

    + (void)pinAllInBackground:(nullable NSArray<PFObject *> *)objects
                         block:(nullable PFBooleanResultBlock)block;

    Swift

    class func pinAll(inBackground objects: [PFObject]?, block: PFBooleanResultBlock? = nil)

    Parameters

    objects

    The objects to be pinned.

    block

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

  • Asynchronously stores the objects and every object they point to in the local datastore, recursively.

    If those other objects have not been fetched from Parse, they will not be stored. However, if they have changed data, all the changes will be retained. To get the objects back later, you can use a PFQuery that uses PFQuery., or you can create an unfetched pointer with +objectWithoutDataWithClassName:objectId: and then call fetchFromLocalDatastore: on it.

    See

    unpinAllInBackground:withName:

    Declaration

    Objective-C

    + (id)pinAllInBackground:(nullable NSArray<PFObject *> *)objects
                    withName:(nonnull NSString *)name;

    Swift

    class func pinAll(inBackground objects: [PFObject]?, withName name: String) -> Any!

    Parameters

    objects

    The objects to be pinned.

    name

    The name of the pin.

    Return Value

    The task that encapsulates the work being done.

  • Asynchronously stores the objects and every object they point to in the local datastore, recursively.

    If those other objects have not been fetched from Parse, they will not be stored. However, if they have changed data, all the changes will be retained. To get the objects back later, you can use a PFQuery that uses PFQuery., or you can create an unfetched pointer with +objectWithoutDataWithClassName:objectId: and then call fetchFromLocalDatastore: on it.

    See

    unpinAllInBackground:withName:block:

    Declaration

    Objective-C

    + (void)pinAllInBackground:(nullable NSArray<PFObject *> *)objects
                      withName:(nonnull NSString *)name
                         block:(nullable PFBooleanResultBlock)block;

    Swift

    class func pinAll(inBackground objects: [PFObject]?, withName name: String, block: PFBooleanResultBlock? = nil)

    Parameters

    objects

    The objects to be pinned.

    name

    The name of the pin.

    block

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

Unpinning

  • Asynchronously removes the object and every object it points to in the local datastore, recursively, using a default pin name: PFObjectDefaultPin.

    See

    pinInBackground

    See

    PFObjectDefaultPin

    Declaration

    Objective-C

    - (id)unpinInBackground;

    Swift

    func unpinInBackground() -> Any!

    Return Value

    The task that encapsulates the work being done.

  • Asynchronously removes the object and every object it points to in the local datastore, recursively, using a default pin name: PFObjectDefaultPin.

    See

    pinInBackgroundWithBlock:

    See

    PFObjectDefaultPin

    Declaration

    Objective-C

    - (void)unpinInBackgroundWithBlock:(nullable PFBooleanResultBlock)block;

    Swift

    func unpinInBackground() async throws -> Bool

    Parameters

    block

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

  • Asynchronously removes the object and every object it points to in the local datastore, recursively.

    See

    pinInBackgroundWithName:

    Declaration

    Objective-C

    - (id)unpinInBackgroundWithName:(nonnull NSString *)name;

    Swift

    func unpinInBackground(withName name: String) -> Any!

    Parameters

    name

    The name of the pin.

    Return Value

    The task that encapsulates the work being done.

  • Asynchronously removes the object and every object it points to in the local datastore, recursively.

    See

    pinInBackgroundWithName:block:

    Declaration

    Objective-C

    - (void)unpinInBackgroundWithName:(nonnull NSString *)name
                                block:(nullable PFBooleanResultBlock)block;

    Swift

    func unpinInBackground(withName name: String, block: PFBooleanResultBlock? = nil)

    Parameters

    name

    The name of the pin.

    block

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

Unpinning Many Objects

  • Asynchronously removes all objects in the local datastore using a default pin name: PFObjectDefaultPin.

    See

    PFObjectDefaultPin

    Declaration

    Objective-C

    + (id)unpinAllObjectsInBackground;

    Swift

    class func unpinAllObjectsInBackground() -> Any!

    Return Value

    The task that encapsulates the work being done.

  • Asynchronously removes all objects in the local datastore using a default pin name: PFObjectDefaultPin.

    See

    PFObjectDefaultPin

    Declaration

    Objective-C

    + (void)unpinAllObjectsInBackgroundWithBlock:
        (nullable PFBooleanResultBlock)block;

    Swift

    class func unpinAllObjectsInBackground() async throws -> Bool

    Parameters

    block

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

  • Asynchronously removes all objects with the specified pin name.

    Declaration

    Objective-C

    + (id)unpinAllObjectsInBackgroundWithName:(nonnull NSString *)name;

    Swift

    class func unpinAllObjectsInBackground(withName name: String) -> Any!

    Parameters

    name

    The name of the pin.

    Return Value

    The task that encapsulates the work being done.

  • Asynchronously removes all objects with the specified pin name.

    Declaration

    Objective-C

    + (void)unpinAllObjectsInBackgroundWithName:(nonnull NSString *)name
                                          block:
                                              (nullable PFBooleanResultBlock)block;

    Swift

    class func unpinAllObjectsInBackground(withName name: String, block: PFBooleanResultBlock? = nil)

    Parameters

    name

    The name of the pin.

    block

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

  • Asynchronously removes the objects and every object they point to in the local datastore, recursively, using a default pin name: PFObjectDefaultPin.

    See

    pinAllInBackground:

    See

    PFObjectDefaultPin

    Declaration

    Objective-C

    + (id)unpinAllInBackground:(nullable NSArray<PFObject *> *)objects;

    Swift

    class func unpinAll(inBackground objects: [PFObject]?) -> Any!

    Parameters

    objects

    The objects.

    Return Value

    The task that encapsulates the work being done.

  • Asynchronously removes the objects and every object they point to in the local datastore, recursively, using a default pin name: PFObjectDefaultPin.

    See

    pinAllInBackground:block:

    See

    PFObjectDefaultPin

    Declaration

    Objective-C

    + (void)unpinAllInBackground:(nullable NSArray<PFObject *> *)objects
                           block:(nullable PFBooleanResultBlock)block;

    Swift

    class func unpinAll(inBackground objects: [PFObject]?, block: PFBooleanResultBlock? = nil)

    Parameters

    objects

    The objects.

    block

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

  • Asynchronously removes the objects and every object they point to in the local datastore, recursively.

    See

    pinAllInBackground:withName:

    Declaration

    Objective-C

    + (id)unpinAllInBackground:(nullable NSArray<PFObject *> *)objects
                      withName:(nonnull NSString *)name;

    Swift

    class func unpinAll(inBackground objects: [PFObject]?, withName name: String) -> Any!

    Parameters

    objects

    The objects.

    name

    The name of the pin.

    Return Value

    The task that encapsulates the work being done.

  • Asynchronously removes the objects and every object they point to in the local datastore, recursively.

    See

    pinAllInBackground:withName:block:

    Declaration

    Objective-C

    + (void)unpinAllInBackground:(nullable NSArray<PFObject *> *)objects
                        withName:(nonnull NSString *)name
                           block:(nullable PFBooleanResultBlock)block;

    Swift

    class func unpinAll(inBackground objects: [PFObject]?, withName name: String, block: PFBooleanResultBlock? = nil)

    Parameters

    objects

    The objects.

    name

    The name of the pin.

    block

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

Saving Objects

  • Deprecated

    Please use PFObject.-saveInBackgroundWithBlock: instead.

    Saves the PFObject asynchronously and calls the given callback.

    @deprecated Please use PFObject.-saveInBackgroundWithBlock: instead.

    Declaration

    Objective-C

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

    Swift

    func saveInBackground(withTarget target: Any?, selector: 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.

Saving Many Objects

  • Deprecated

    Please use PFObject.+saveAllInBackground:block: instead.

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

    @deprecated Please use PFObject.+saveAllInBackground:block: instead.

    Declaration

    Objective-C

    + (void)saveAllInBackground:(nullable NSArray<PFObject *> *)objects
                         target:(nullable id)target
                       selector:(nullable SEL)selector;

    Swift

    class func saveAll(inBackground objects: [PFObject]?, target: Any?, selector: 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)callbackWithResult:(NSNumber *)number 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.

Getting an Object

  • Deprecated

    Please use PFObject.-fetchInBackgroundWithBlock: instead.

    Asynchronously refreshes the PFObject and calls the given callback.

    @deprecated Please use PFObject.-fetchInBackgroundWithBlock: instead.

    Declaration

    Objective-C

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

    Swift

    func refreshInBackground(withTarget target: Any?, selector: 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.

  • Deprecated

    Please use PFObject.-fetchInBackgroundWithBlock: instead.

    Fetches the `PFObject asynchronously and calls the given callback.

    @deprecated Please use PFObject.-fetchInBackgroundWithBlock: instead.

    Declaration

    Objective-C

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

    Swift

    func fetchInBackground(withTarget target: Any?, selector: 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.

  • Deprecated

    Please use PFObject.-fetchIfNeededInBackgroundWithBlock: instead.

    Fetches the PFObject’s data asynchronously if dataAvailable is NO, then calls the callback.

    @deprecated Please use PFObject.-fetchIfNeededInBackgroundWithBlock: instead.

    Declaration

    Objective-C

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

    Swift

    func fetchIfNeededInBackground(withTarget target: Any?, selector: 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. refreshedObject will be the PFObject with the refreshed data.

Getting Many Objects

  • Deprecated

    Please use PFObject.+fetchAllInBackground:block: instead.

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

    @deprecated Please use PFObject.+fetchAllInBackground:block: instead.

    Declaration

    Objective-C

    + (void)fetchAllInBackground:(nullable NSArray<PFObject *> *)objects
                          target:(nullable id)target
                        selector:(nullable SEL)selector;

    Swift

    class func fetchAll(inBackground objects: [PFObject]?, target: Any?, selector: 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 PFObject objects that were fetched.

  • Deprecated

    Please use PFObject.+fetchAllIfNeededInBackground:block: instead.

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

    @deprecated Please use PFObject.+fetchAllIfNeededInBackground:block: instead.

    Declaration

    Objective-C

    + (void)fetchAllIfNeededInBackground:(nullable NSArray<PFObject *> *)objects
                                  target:(nullable id)target
                                selector:(nullable SEL)selector;

    Swift

    class func fetchAllIfNeeded(inBackground objects: [PFObject]?, target: Any?, selector: 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 PFObject objects that were fetched.

Deleting an Object

  • Deprecated

    Please use PFObject.-deleteInBackgroundWithBlock: instead.

    Deletes the PFObject asynchronously and calls the given callback.

    @deprecated Please use PFObject.-deleteInBackgroundWithBlock: instead.

    Declaration

    Objective-C

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

    Swift

    func deleteInBackground(withTarget target: Any?, selector: 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.

Deleting Many Objects

  • Deprecated

    Please use PFObject.+deleteAllInBackground:block: instead.

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

    @deprecated Please use PFObject.+deleteAllInBackground:block: instead.

    Declaration

    Objective-C

    + (void)deleteAllInBackground:(nullable NSArray<PFObject *> *)objects
                           target:(nullable id)target
                         selector:(nullable SEL)selector;

    Swift

    class func deleteAll(inBackground objects: [PFObject]?, target: Any?, selector: 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)callbackWithResult:(NSNumber *)number 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.

Methods for Subclasses

  • Creates an instance of the registered subclass with this class’s PFSubclassing.+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.

    Declaration

    Objective-C

    + (nonnull instancetype)object;
  • Creates a reference to an existing PFObject for use in creating associations between PFObjects.

    Calling dataAvailable on this object will return NO until -fetchIfNeeded or -fetch has been called. This method can only be called on subclasses which conform to PFSubclassing. A default implementation is provided by PFObject which should always be sufficient. No network request will be made.

    Declaration

    Objective-C

    + (nonnull instancetype)objectWithoutDataWithObjectId:
        (nullable NSString *)objectId;

    Swift

    convenience init(withoutDataWithObjectId objectId: String?)

    Parameters

    objectId

    The object id for the referenced object.

    Return Value

    An instance of PFObject without data.

  • 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 that matches [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.

    Declaration

    Objective-C

    + (void)registerSubclass;

    Swift

    class func registerSubclass()
  • Returns a query for objects of type PFSubclassing.+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.

    See

    PFQuery

    Declaration

    Objective-C

    + (nullable PFQuery *)query;

    Swift

    class func query() -> PFQuery?
  • Returns a query for objects of type PFSubclassing.+parseClassName with a given predicate.

    A default implementation is provided by PFObject which should always be sufficient.

    Warning

    This method can only be called on subclasses which conform to PFSubclassing.

    Declaration

    Objective-C

    + (nullable PFQuery *)queryWithPredicate:(nullable NSPredicate *)predicate;

    Swift

    class func query(with predicate: NSPredicate?) -> PFQuery?

    Parameters

    predicate

    The predicate to create conditions from.

    Return Value

    An instance of PFQuery.

Saving Objects

  • Synchronously saves the PFObject.

    Declaration

    Objective-C

    - (BOOL)save;

    Return Value

    Returns whether the save succeeded.

  • Synchronously saves the PFObject and sets an error if it occurs.

    Declaration

    Objective-C

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

    Swift

    func save() throws

    Parameters

    error

    Pointer to an NSError that will be set if necessary.

    Return Value

    Returns whether the save succeeded.

Saving Many Objects

  • Saves a collection of objects *synchronously all at once.

    Declaration

    Objective-C

    + (BOOL)saveAll:(nullable NSArray<PFObject *> *)objects;

    Parameters

    objects

    The array of objects to save.

    Return Value

    Returns whether the save succeeded.

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

    Declaration

    Objective-C

    + (BOOL)saveAll:(nullable NSArray<PFObject *> *)objects
              error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func saveAll(_ objects: [PFObject]?) throws

    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.

Getting an Object

  • Synchronously* fetches the PFObject with the current data from the server.

    Declaration

    Objective-C

    - (nullable instancetype)fetch;
  • Synchronously fetches the PFObject with the current data from the server and sets an error if it occurs.

    Declaration

    Objective-C

    - (nullable instancetype)fetch:(NSError *_Nullable *_Nullable)error;

    Swift

    func fetch() throws -> Self

    Parameters

    error

    Pointer to an NSError that will be set if necessary.

  • Synchronously* fetches the PFObject data from the server if dataAvailable is NO.

    Declaration

    Objective-C

    - (nullable instancetype)fetchIfNeeded;
  • Synchronously fetches the PFObject data from the server if dataAvailable is NO.

    Declaration

    Objective-C

    - (nullable instancetype)fetchIfNeeded:(NSError *_Nullable *_Nullable)error;

    Swift

    func fetchIfNeeded() throws -> Self

    Parameters

    error

    Pointer to an NSError that will be set if necessary.

Getting Many Objects

  • Synchronously fetches all of the PFObject objects with the current data from the server.

    Declaration

    Objective-C

    + (nullable NSArray<__kindof PFObject *> *)fetchAll:
        (nullable NSArray<PFObject *> *)objects;

    Parameters

    objects

    The list of objects to fetch.

  • Synchronously fetches all of the PFObject objects with the current data from the server and sets an error if it occurs.

    Declaration

    Objective-C

    + (nullable NSArray<__kindof PFObject *> *)
        fetchAll:(nullable NSArray<PFObject *> *)objects
           error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func fetchAll(_ objects: [PFObject]?) throws -> [PFObject]

    Parameters

    objects

    The list of objects to fetch.

    error

    Pointer to an NSError that will be set if necessary.

  • Synchronously fetches all of the PFObject objects with the current data from the server.

    Declaration

    Objective-C

    + (nullable NSArray<__kindof PFObject *> *)fetchAllIfNeeded:
        (nullable NSArray<PFObject *> *)objects;

    Parameters

    objects

    The list of objects to fetch.

  • Synchronously fetches all of the PFObject objects with the current data from the server and sets an error if it occurs.

    Declaration

    Objective-C

    + (nullable NSArray<__kindof PFObject *> *)
        fetchAllIfNeeded:(nullable NSArray<PFObject *> *)objects
                   error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func fetchAllIfNeeded(_ objects: [PFObject]?) throws -> [PFObject]

    Parameters

    objects

    The list of objects to fetch.

    error

    Pointer to an NSError that will be set if necessary.

Fetching From Local Datastore

  • Synchronously loads data from the local datastore into this object, if it has not been fetched from the server already.

    Declaration

    Objective-C

    - (nullable instancetype)fetchFromLocalDatastore;
  • Synchronously loads data from the local datastore into this object, if it has not been fetched from the server already.

    If the object is not stored in the local datastore, this error will be set to return kPFErrorCacheMiss.

    Declaration

    Objective-C

    - (nullable instancetype)fetchFromLocalDatastore:
        (NSError *_Nullable *_Nullable)error;

    Swift

    func fetchFromLocalDatastore() throws -> Self

    Parameters

    error

    Pointer to an NSError that will be set if necessary.

Deleting an Object

  • Synchronously deletes the PFObject.

    Declaration

    Objective-C

    - (BOOL)delete;

    Return Value

    Returns whether the delete succeeded.

  • Synchronously deletes the PFObject and sets an error if it occurs.

    Declaration

    Objective-C

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

    Swift

    func delete() throws

    Parameters

    error

    Pointer to an NSError that will be set if necessary.

    Return Value

    Returns whether the delete succeeded.

Deleting Many Objects

  • Synchronously deletes a collection of objects all at once.

    Declaration

    Objective-C

    + (BOOL)deleteAll:(nullable NSArray<PFObject *> *)objects;

    Parameters

    objects

    The array of objects to delete.

    Return Value

    Returns whether the delete succeeded.

  • Synchronously deletes a collection of objects all at once and sets an error if necessary.

    Declaration

    Objective-C

    + (BOOL)deleteAll:(nullable NSArray<PFObject *> *)objects
                error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func deleteAll(_ objects: [PFObject]?) throws

    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.

Pinning

  • Synchronously stores the object and every object it points to in the local datastore, recursively, using a default pin name: PFObjectDefaultPin.

    If those other objects have not been fetched from Parse, they will not be stored. However, if they have changed data, all the changes will be retained. To get the objects back later, you can use a PFQuery that uses PFQuery., or you can create an unfetched pointer with +objectWithoutDataWithClassName:objectId: and then call -fetchFromLocalDatastore on it.

    See

    -unpin:

    Declaration

    Objective-C

    - (BOOL)pin;

    Return Value

    Returns whether the pin succeeded.

  • Synchronously stores the object and every object it points to in the local datastore, recursively, using a default pin name: PFObjectDefaultPin.

    If those other objects have not been fetched from Parse, they will not be stored. However, if they have changed data, all the changes will be retained. To get the objects back later, you can use a PFQuery that uses PFQuery., or you can create an unfetched pointer with +objectWithoutDataWithClassName:objectId: and then call -fetchFromLocalDatastore on it.

    See

    -unpin:

    Declaration

    Objective-C

    - (BOOL)pin:(NSError *_Nullable *_Nullable)error;

    Swift

    func pin() throws

    Parameters

    error

    Pointer to an NSError that will be set if necessary.

    Return Value

    Returns whether the pin succeeded.

  • Synchronously stores the object and every object it points to in the local datastore, recursively.

    If those other objects have not been fetched from Parse, they will not be stored. However, if they have changed data, all the changes will be retained. To get the objects back later, you can use a PFQuery that uses PFQuery., or you can create an unfetched pointer with +objectWithoutDataWithClassName:objectId: and then call -fetchFromLocalDatastore on it.

    Declaration

    Objective-C

    - (BOOL)pinWithName:(nonnull NSString *)name;

    Parameters

    name

    The name of the pin.

    Return Value

    Returns whether the pin succeeded.

  • Synchronously stores the object and every object it points to in the local datastore, recursively.

    If those other objects have not been fetched from Parse, they will not be stored. However, if they have changed data, all the changes will be retained. To get the objects back later, you can use a PFQuery that uses PFQuery., or you can create an unfetched pointer with +objectWithoutDataWithClassName:objectId: and then call -fetchFromLocalDatastore on it.

    Declaration

    Objective-C

    - (BOOL)pinWithName:(nonnull NSString *)name
                  error:(NSError *_Nullable *_Nullable)error;

    Swift

    func pin(withName name: String) throws

    Parameters

    name

    The name of the pin.

    error

    Pointer to an NSError that will be set if necessary.

    Return Value

    Returns whether the pin succeeded.

Pinning Many Objects

  • Synchronously stores the objects and every object they point to in the local datastore, recursively, using a default pin name: PFObjectDefaultPin.

    If those other objects have not been fetched from Parse, they will not be stored. However, if they have changed data, all the changes will be retained. To get the objects back later, you can use a PFQuery that uses PFQuery., or you can create an unfetched pointer with +objectWithoutDataWithClassName:objectId: and then call fetchFromLocalDatastore: on it.

    See

    unpinAll:

    See

    PFObjectDefaultPin

    Declaration

    Objective-C

    + (BOOL)pinAll:(nullable NSArray<PFObject *> *)objects;

    Parameters

    objects

    The objects to be pinned.

    Return Value

    Returns whether the pin succeeded.

  • Synchronously stores the objects and every object they point to in the local datastore, recursively, using a default pin name: PFObjectDefaultPin.

    If those other objects have not been fetched from Parse, they will not be stored. However, if they have changed data, all the changes will be retained. To get the objects back later, you can use a PFQuery that uses PFQuery., or you can create an unfetched pointer with +objectWithoutDataWithClassName:objectId: and then call fetchFromLocalDatastore: on it.

    See

    unpinAll:error:

    See

    PFObjectDefaultPin

    Declaration

    Objective-C

    + (BOOL)pinAll:(nullable NSArray<PFObject *> *)objects
             error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func pinAll(_ objects: [PFObject]?) throws

    Parameters

    objects

    The objects to be pinned.

    error

    Pointer to an NSError that will be set if necessary.

    Return Value

    Returns whether the pin succeeded.

  • Synchronously stores the objects and every object they point to in the local datastore, recursively.

    If those other objects have not been fetched from Parse, they will not be stored. However, if they have changed data, all the changes will be retained. To get the objects back later, you can use a PFQuery that uses PFQuery., or you can create an unfetched pointer with +objectWithoutDataWithClassName:objectId: and then call fetchFromLocalDatastore: on it.

    See

    unpinAll:withName:

    Declaration

    Objective-C

    + (BOOL)pinAll:(nullable NSArray<PFObject *> *)objects
          withName:(nonnull NSString *)name;

    Parameters

    objects

    The objects to be pinned.

    name

    The name of the pin.

    Return Value

    Returns whether the pin succeeded.

  • Synchronously stores the objects and every object they point to in the local datastore, recursively.

    If those other objects have not been fetched from Parse, they will not be stored. However, if they have changed data, all the changes will be retained. To get the objects back later, you can use a PFQuery that uses PFQuery., or you can create an unfetched pointer with +objectWithoutDataWithClassName:objectId: and then call fetchFromLocalDatastore: on it.

    See

    unpinAll:withName:error:

    Declaration

    Objective-C

    + (BOOL)pinAll:(nullable NSArray<PFObject *> *)objects
          withName:(nonnull NSString *)name
             error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func pinAll(_ objects: [PFObject]?, withName name: String) throws

    Parameters

    objects

    The objects to be pinned.

    name

    The name of the pin.

    error

    Pointer to an NSError that will be set if necessary.

    Return Value

    Returns whether the pin succeeded.

Unpinning

  • Synchronously removes the object and every object it points to in the local datastore, recursively, using a default pin name: PFObjectDefaultPin.

    See

    pin:

    See

    PFObjectDefaultPin

    Declaration

    Objective-C

    - (BOOL)unpin;

    Return Value

    Returns whether the unpin succeeded.

  • Synchronously removes the object and every object it points to in the local datastore, recursively, using a default pin name: PFObjectDefaultPin.

    See

    pin:

    See

    PFObjectDefaultPin

    Declaration

    Objective-C

    - (BOOL)unpin:(NSError *_Nullable *_Nullable)error;

    Swift

    func unpin() throws

    Parameters

    error

    Pointer to an NSError that will be set if necessary.

    Return Value

    Returns whether the unpin succeeded.

  • Synchronously removes the object and every object it points to in the local datastore, recursively.

    See

    pinWithName:

    Declaration

    Objective-C

    - (BOOL)unpinWithName:(nonnull NSString *)name;

    Parameters

    name

    The name of the pin.

    Return Value

    Returns whether the unpin succeeded.

  • Synchronously removes the object and every object it points to in the local datastore, recursively.

    See

    pinWithName:error:

    Declaration

    Objective-C

    - (BOOL)unpinWithName:(nonnull NSString *)name
                    error:(NSError *_Nullable *_Nullable)error;

    Swift

    func unpin(withName name: String) throws

    Parameters

    name

    The name of the pin.

    error

    Pointer to an NSError that will be set if necessary.

    Return Value

    Returns whether the unpin succeeded.

Unpinning Many Objects

  • Synchronously removes all objects in the local datastore using a default pin name: PFObjectDefaultPin.

    See

    PFObjectDefaultPin

    Declaration

    Objective-C

    + (BOOL)unpinAllObjects;

    Return Value

    Returns whether the unpin succeeded.

  • Synchronously removes all objects in the local datastore using a default pin name: PFObjectDefaultPin.

    See

    PFObjectDefaultPin

    Declaration

    Objective-C

    + (BOOL)unpinAllObjects:(NSError *_Nullable *_Nullable)error;

    Swift

    class func unpinAllObjects() throws

    Parameters

    error

    Pointer to an NSError that will be set if necessary.

    Return Value

    Returns whether the unpin succeeded.

  • Synchronously removes all objects with the specified pin name.

    Declaration

    Objective-C

    + (BOOL)unpinAllObjectsWithName:(nonnull NSString *)name;

    Parameters

    name

    The name of the pin.

    Return Value

    Returns whether the unpin succeeded.

  • Synchronously removes all objects with the specified pin name.

    Declaration

    Objective-C

    + (BOOL)unpinAllObjectsWithName:(nonnull NSString *)name
                              error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func unpinAllObjects(withName name: String) throws

    Parameters

    name

    The name of the pin.

    error

    Pointer to an NSError that will be set if necessary.

    Return Value

    Returns whether the unpin succeeded.

  • Synchronously removes the objects and every object they point to in the local datastore, recursively, using a default pin name: PFObjectDefaultPin.

    See

    pinAll:

    See

    PFObjectDefaultPin

    Declaration

    Objective-C

    + (BOOL)unpinAll:(nullable NSArray<PFObject *> *)objects;

    Parameters

    objects

    The objects.

    Return Value

    Returns whether the unpin succeeded.

  • Synchronously removes the objects and every object they point to in the local datastore, recursively, using a default pin name: PFObjectDefaultPin.

    See

    pinAll:error:

    See

    PFObjectDefaultPin

    Declaration

    Objective-C

    + (BOOL)unpinAll:(nullable NSArray<PFObject *> *)objects
               error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func unpinAll(_ objects: [PFObject]?) throws

    Parameters

    objects

    The objects.

    error

    Pointer to an NSError that will be set if necessary.

    Return Value

    Returns whether the unpin succeeded.

  • Synchronously removes the objects and every object they point to in the local datastore, recursively.

    See

    pinAll:withName:

    Declaration

    Objective-C

    + (BOOL)unpinAll:(nullable NSArray<PFObject *> *)objects
            withName:(nonnull NSString *)name;

    Parameters

    objects

    The objects.

    name

    The name of the pin.

    Return Value

    Returns whether the unpin succeeded.

  • Synchronously removes the objects and every object they point to in the local datastore, recursively.

    See

    pinAll:withName:error:

    Declaration

    Objective-C

    + (BOOL)unpinAll:(nullable NSArray<PFObject *> *)objects
            withName:(nonnull NSString *)name
               error:(NSError *_Nullable *_Nullable)error;

    Swift

    class func unpinAll(_ objects: [PFObject]?, withName name: String) throws

    Parameters

    objects

    The objects.

    name

    The name of the pin.

    error

    Pointer to an NSError that will be set if necessary.

    Return Value

    Returns whether the unpin succeeded.