PFFacebookUtils

@interface PFFacebookUtils : NSObject

The PFFacebookUtils class provides utility functions for using Facebook authentication with PFUsers.

Warning

This class supports official Facebook iOS SDK v4.0+ and is available only on iOS.
  • Initializes Parse Facebook Utils.

    You must provide your Facebook application ID as the value for FacebookAppID in your bundle’s plist file as described here: https://developers.facebook.com/docs/getting-started/facebook-sdk-for-ios/

    Warning

    You must invoke this in order to use the Facebook functionality in Parse.

    Declaration

    Objective-C

    + (void)initializeFacebookWithApplicationLaunchOptions:
            (nullable NSDictionary *)launchOptions;

    Parameters

    launchOptions

    The launchOptions as passed to [UIApplicationDelegate application:didFinishLaunchingWithOptions:].

  • FBSDKLoginManager provides methods for configuring login behavior, default audience and managing Facebook Access Token.

    Warning

    This method is available only on iOS.

    Declaration

    Objective-C

    + (id)facebookLoginManager;

    Return Value

    An instance of FBSDKLoginManager that is used by PFFacebookUtils.

  • Asynchronously logs in a user using Facebook with read permissions.

    This method delegates to the Facebook SDK to authenticate the user, and then automatically logs in (or creates, in the case where it is a new user) a PFUser.

    Declaration

    Objective-C

    + (nonnull BFTask<PFUser *> *)logInInBackgroundWithReadPermissions:
            (nullable NSArray<NSString *> *)permissions;

    Parameters

    permissions

    Array of read permissions to use.

    Return Value

    The task that has will a have result set to PFUser if operation succeeds.

  • Asynchronously logs in a user using Facebook with read permissions.

    This method delegates to the Facebook SDK to authenticate the user, and then automatically logs in (or creates, in the case where it is a new user) a PFUser.

    Declaration

    Objective-C

    + (void)logInInBackgroundWithReadPermissions:
                (nullable NSArray<NSString *> *)permissions
                                           block:(nullable PFUserResultBlock)block;

    Parameters

    permissions

    Array of read permissions to use.

    block
      The block to execute when the log in completes.
    

    It should have the following signature: ^(PFUser *user, NSError *error).

  • Asynchronously logs in a user using Facebook with publish permissions.

    This method delegates to the Facebook SDK to authenticate the user, and then automatically logs in (or creates, in the case where it is a new user) a PFUser.

    Declaration

    Objective-C

    + (nonnull BFTask<PFUser *> *)logInInBackgroundWithPublishPermissions:
            (nullable NSArray<NSString *> *)permissions;

    Parameters

    permissions

    Array of publish permissions to use.

    Return Value

    The task that has will a have result set to PFUser if operation succeeds.

  • Asynchronously logs in a user using Facebook with publish permissions.

    This method delegates to the Facebook SDK to authenticate the user, and then automatically logs in (or creates, in the case where it is a new user) a PFUser.

    Declaration

    Objective-C

    + (void)logInInBackgroundWithPublishPermissions:
                (nullable NSArray<NSString *> *)permissions
                                              block:
                                                  (nullable PFUserResultBlock)block;

    Parameters

    permissions

    Array of publish permissions to use.

    block
      The block to execute when the log in completes.
    

    It should have the following signature: ^(PFUser *user, NSError *error).

  • Asynchronously logs in a user using given Facebook Acess Token.

    This method delegates to the Facebook SDK to authenticate the user, and then automatically logs in (or creates, in the case where it is a new user) a PFUser.

    Declaration

    Objective-C

    + (nonnull BFTask<PFUser *> *)logInInBackgroundWithAccessToken:(id)accessToken;

    Parameters

    accessToken

    An instance of FBSDKAccessToken to use when logging in.

    Return Value

    The task that has will a have result set to PFUser if operation succeeds.

  • Asynchronously logs in a user using given Facebook Acess Token.

    This method delegates to the Facebook SDK to authenticate the user, and then automatically logs in (or creates, in the case where it is a new user) a PFUser.

    Declaration

    Objective-C

    + (void)logInInBackgroundWithAccessToken:(id)accessToken
                                       block:(nullable PFUserResultBlock)block;

    Parameters

    accessToken

    An instance of FBSDKAccessToken to use when logging in.

    block
      The block to execute when the log in completes.
    

    It should have the following signature: ^(PFUser *user, NSError *error).

  • Asynchronously links Facebook with read permissions to an existing PFUser.

    This method delegates to the Facebook SDK to authenticate the user, and then automatically links the account to the PFUser. It will also save any unsaved changes that were made to the user.

    Declaration

    Objective-C

    + (nonnull BFTask<NSNumber *> *)
        linkUserInBackground:(nonnull PFUser *)user
         withReadPermissions:(nullable NSArray<NSString *> *)permissions;

    Parameters

    user

    User to link to Facebook.

    permissions

    Array of read permissions to use when logging in with Facebook.

    Return Value

    The task that will have a result set to @YES if operation succeeds.

  • Asynchronously links Facebook with read permissions to an existing PFUser.

    This method delegates to the Facebook SDK to authenticate the user, and then automatically links the account to the PFUser. It will also save any unsaved changes that were made to the user.

    Declaration

    Objective-C

    + (void)linkUserInBackground:(nonnull PFUser *)user
             withReadPermissions:(nullable NSArray<NSString *> *)permissions
                           block:(nullable PFBooleanResultBlock)block;

    Parameters

    user

    User to link to Facebook.

    permissions

    Array of read permissions to use.

    block
      The block to execute when the linking completes.
    

    It should have the following signature: ^(BOOL succeeded, NSError *error).

  • Asynchronously links Facebook with publish permissions to an existing PFUser.

    This method delegates to the Facebook SDK to authenticate the user, and then automatically links the account to the PFUser. It will also save any unsaved changes that were made to the user.

    Declaration

    Objective-C

    + (nonnull BFTask<NSNumber *> *)linkUserInBackground:(nonnull PFUser *)user
                                  withPublishPermissions:
                                      (nonnull NSArray<NSString *> *)permissions;

    Parameters

    user

    User to link to Facebook.

    permissions

    Array of publish permissions to use.

    Return Value

    The task that will have a result set to @YES if operation succeeds.

  • Asynchronously links Facebook with publish permissions to an existing PFUser.

    This method delegates to the Facebook SDK to authenticate the user, and then automatically links the account to the PFUser. It will also save any unsaved changes that were made to the user.

    Declaration

    Objective-C

    + (void)linkUserInBackground:(nonnull PFUser *)user
          withPublishPermissions:(nonnull NSArray<NSString *> *)permissions
                           block:(nullable PFBooleanResultBlock)block;

    Parameters

    user

    User to link to Facebook.

    permissions

    Array of publish permissions to use.

    block
      The block to execute when the linking completes.
    

    It should have the following signature: ^(BOOL succeeded, NSError *error).

  • Asynchronously links Facebook Access Token to an existing PFUser.

    This method delegates to the Facebook SDK to authenticate the user, and then automatically links the account to the PFUser. It will also save any unsaved changes that were made to the user.

    Declaration

    Objective-C

    + (nonnull BFTask<NSNumber *> *)linkUserInBackground:(nonnull PFUser *)user
                                         withAccessToken:(id)accessToken;

    Parameters

    user

    User to link to Facebook.

    accessToken

    An instance of FBSDKAccessToken to use.

    Return Value

    The task that will have a result set to @YES if operation succeeds.

  • Asynchronously links Facebook Access Token to an existing PFUser.

    This method delegates to the Facebook SDK to authenticate the user, and then automatically links the account to the PFUser. It will also save any unsaved changes that were made to the user.

    Declaration

    Objective-C

    + (void)linkUserInBackground:(nonnull PFUser *)user
                 withAccessToken:(id)accessToken
                           block:(nullable PFBooleanResultBlock)block;

    Parameters

    user

    User to link to Facebook.

    accessToken

    An instance of FBSDKAccessToken to use.

    block
      The block to execute when the linking completes.
    

    It should have the following signature: ^(BOOL succeeded, NSError *error).

  • Unlinks the PFUser from a Facebook account asynchronously.

    Declaration

    Objective-C

    + (nonnull BFTask<NSNumber *> *)unlinkUserInBackground:(nonnull PFUser *)user;

    Parameters

    user

    User to unlink from Facebook.

    Return Value

    The task, that encapsulates the work being done.

  • Unlinks the PFUser from a Facebook account asynchronously.

    Declaration

    Objective-C

    + (void)unlinkUserInBackground:(nonnull PFUser *)user
                             block:(nullable PFBooleanResultBlock)block;

    Parameters

    user

    User to unlink from Facebook.

    block

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

  • Whether the user has their account linked to Facebook.

    Declaration

    Objective-C

    + (BOOL)isLinkedWithUser:(nonnull PFUser *)user;

    Parameters

    user

    User to check for a facebook link. The user must be logged in on this device.

    Return Value

    YES if the user has their account linked to Facebook, otherwise NO.