PFSubclassing Protocol Reference

Declared in PFSubclassing.h

Overview

If a subclass of PFObject conforms to PFSubclassing and calls registerSubclass, Parse framework will be able to use that class as the native class for a Parse cloud object.

Classes conforming to this protocol should subclass PFObject and include PFObject+Subclass.h in their implementation file. This ensures the methods in the Subclass category of PFObject are exposed in its subclasses only.

+ object required method

Constructs an object of the most specific class known to implement parseClassName.

+ (instancetype)object

Return Value

Returns the object that is instantiated.

Discussion

This method takes care to help PFObject subclasses be subclassed themselves. For example, [PFUser object] returns a PFUser by default but will return an object of a registered subclass instead if one is known. A default implementation is provided by PFObject which should always be sufficient.

Declared In

PFSubclassing.h

+ objectWithoutDataWithObjectId: required method

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

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

Parameters

objectId

The object id for the referenced object.

Return Value

A new PFObject without data.

Discussion

Calling <PFObject.dataAvailable> on this object will return NO until [PFObject fetchIfNeeded] has been called. No network request will be made. A default implementation is provided by PFObject which should always be sufficient.

Declared In

PFSubclassing.h

+ parseClassName required method

The name of the class as seen in the REST API.

+ (NSString *)parseClassName

Declared In

PFSubclassing.h

+ query required method

Create a query which returns objects of this type.

+ (nullable PFQuery *)query

Discussion

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

Declared In

PFSubclassing.h

+ queryWithPredicate: required method

Returns a query for objects of this type with a given predicate.

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

Parameters

predicate

The predicate to create conditions from.

Return Value

An instance of PFQuery.

Discussion

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

Declared In

PFSubclassing.h

+ registerSubclass required method

Lets Parse know this class should be used to instantiate all objects with class type parseClassName.

+ (void)registerSubclass

Discussion

Warning: This method must be called before [Parse setApplicationId:clientKey:]

Declared In

PFSubclassing.h