PFSession

Objective-C

@interface PFSession : PFObject <PFSubclassing>

Swift

class PFSession : PFObject, PFSubclassing

PFSession is a local representation of a session. This class is a subclass of a PFObject, and retains the same functionality as any other subclass of PFObject.

  • The session token string for this session.

    Declaration

    Objective-C

    @property (nonatomic, copy, readonly, nullable) NSString *sessionToken;

    Swift

    var sessionToken: String? { get }
  • Asynchronously fetches a PFSession object related to the current user.

    Declaration

    Objective-C

    + (nonnull BFTask<PFSession *> *)getCurrentSessionInBackground;

    Swift

    class func getCurrentSessionInBackground() -> BFTask<PFSession>

    Return Value

    A task that is completed with an instance of PFSession class or is faulted if the operation fails.

  • Asynchronously fetches a PFSession object related to the current user.

    Declaration

    Objective-C

    + (void)getCurrentSessionInBackgroundWithBlock:
        (nullable PFSessionResultBlock)block;

    Swift

    class func currentSessionInBackground() async throws -> PFSession

    Parameters

    block

    The block to execute when the operation completes. It should have the following argument signature: ^(PFSession *session, NSError *error).