PFTwitterUtils

@interface PFTwitterUtils : NSObject

The PFTwitterUtils class provides utility functions for working with Twitter in a Parse application.

This class is currently for iOS only.

  • Gets the instance of the PF_Twitter object that Parse uses.

    Declaration

    Objective-C

    + (nullable PF_Twitter *)twitter;

    Return Value

    An instance of PF_Twitter object.

  • Initializes the Twitter singleton.

    Warning

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

    Declaration

    Objective-C

    + (void)initializeWithConsumerKey:(nonnull NSString *)consumerKey
                       consumerSecret:(nonnull NSString *)consumerSecret;

    Parameters

    consumerKey

    Your Twitter application’s consumer key.

    consumerSecret

    Your Twitter application’s consumer secret.

  • Whether the user has their account linked to Twitter.

    Declaration

    Objective-C

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

    Parameters

    user

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

    Return Value

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

  • Asynchronously logs in a user using Twitter.

    This method delegates to Twitter 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 *> *)logInInBackground;

    Return Value

    The task, that encapsulates the work being done.

  • Asynchronously logs in a user using Twitter.

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

    Declaration

    Objective-C

    + (void)logInWithBlock:(nullable PFUserResultBlock)block;

    Parameters

    block

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

  • Asynchronously logs in a user using Twitter.

    Allows you to handle user login to Twitter, then provide authentication data to log in (or create, in the case where it is a new user) the PFUser.

    Declaration

    Objective-C

    + (nonnull BFTask<PFUser *> *)
        logInWithTwitterIdInBackground:(nonnull NSString *)twitterId
                            screenName:(nonnull NSString *)screenName
                             authToken:(nonnull NSString *)authToken
                       authTokenSecret:(nonnull NSString *)authTokenSecret;

    Parameters

    twitterId

    The id of the Twitter user being linked.

    screenName

    The screen name of the Twitter user being linked.

    authToken

    The auth token for the user’s session.

    authTokenSecret

    The auth token secret for the user’s session.

    Return Value

    The task, that encapsulates the work being done.

  • Logs in a user using Twitter.

    Allows you to handle user login to Twitter, then provide authentication data to log in (or create, in the case where it is a new user) the PFUser.

    Declaration

    Objective-C

    + (void)logInWithTwitterId:(nonnull NSString *)twitterId
                    screenName:(nonnull NSString *)screenName
                     authToken:(nonnull NSString *)authToken
               authTokenSecret:(nonnull NSString *)authTokenSecret
                         block:(nullable PFUserResultBlock)block;

    Parameters

    twitterId

    The id of the Twitter user being linked

    screenName

    The screen name of the Twitter user being linked

    authToken

    The auth token for the user’s session

    authTokenSecret

    The auth token secret for the user’s session

    block

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

  • Asynchronously links Twitter to an existing PFUser.

    This method delegates to Twitter to authenticate the user, and then automatically links the account to the PFUser.

    @deprecated Please use [PFTwitterUtils linkUserInBackground:] instead.

    Declaration

    Objective-C

    + (void)linkUser:(nonnull PFUser *)user;

    Parameters

    user

    User to link to Twitter.

  • Asynchronously links Twitter to an existing PFUser.

    This method delegates to Twitter to authenticate the user, and then automatically links the account to the PFUser.

    Declaration

    Objective-C

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

    Parameters

    user

    User to link to Twitter.

    Return Value

    The task, that encapsulates the work being done.

  • Asynchronously links Twitter to an existing PFUser.

    This method delegates to Twitter to authenticate the user, and then automatically links the account to the PFUser.

    Declaration

    Objective-C

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

    Parameters

    user

    User to link to Twitter.

    block

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

  • Asynchronously links Twitter to an existing PFUser asynchronously.

    Allows you to handle user login to Twitter, then provide authentication data to link the account to the PFUser.

    Declaration

    Objective-C

    + (nonnull BFTask<NSNumber *> *)
        linkUserInBackground:(nonnull PFUser *)user
                   twitterId:(nonnull NSString *)twitterId
                  screenName:(nonnull NSString *)screenName
                   authToken:(nonnull NSString *)authToken
             authTokenSecret:(nonnull NSString *)authTokenSecret;

    Parameters

    user

    User to link to Twitter.

    twitterId

    The id of the Twitter user being linked.

    screenName

    The screen name of the Twitter user being linked.

    authToken

    The auth token for the user’s session.

    authTokenSecret

    The auth token secret for the user’s session.

    Return Value

    The task, that encapsulates the work being done.

  • Asynchronously links Twitter to an existing PFUser.

    @discussionAllows you to handle user login to Twitter, then provide authentication data to link the account to the PFUser.

    Declaration

    Objective-C

    + (void)linkUser:(nonnull PFUser *)user
              twitterId:(nonnull NSString *)twitterId
             screenName:(nonnull NSString *)screenName
              authToken:(nonnull NSString *)authToken
        authTokenSecret:(nonnull NSString *)authTokenSecret
                  block:(nullable PFBooleanResultBlock)block;

    Parameters

    user

    User to link to Twitter.

    twitterId

    The id of the Twitter user being linked.

    screenName

    The screen name of the Twitter user being linked.

    authToken

    The auth token for the user’s session.

    authTokenSecret

    The auth token secret for the user’s session.

    block

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

  • Synchronously unlinks the PFUser from a Twitter account.

    Declaration

    Objective-C

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

    Parameters

    user

    User to unlink from Twitter.

    Return Value

    Returns true if the unlink was successful.

  • Synchronously unlinks the PFUser from a Twitter account.

    Declaration

    Objective-C

    + (BOOL)unlinkUser:(nonnull PFUser *)user
                 error:(NSError *_Nullable *_Nullable)error;

    Parameters

    user

    User to unlink from Twitter.

    error

    Error object to set on error.

    Return Value

    Returns YES if the unlink was successful, otherwise NO.

  • Makes an asynchronous request to unlink a user from a Twitter account.

    Declaration

    Objective-C

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

    Parameters

    user

    User to unlink from Twitter.

    Return Value

    The task, that encapsulates the work being done.

  • Makes an asynchronous request to unlink a user from a Twitter account.

    Declaration

    Objective-C

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

    Parameters

    user

    User to unlink from Twitter.

    block

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