PFTwitterUtils Class Reference

Inherits from NSObject
Declared in PFTwitterUtils.h

Overview

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

This class is currently for iOS only.

Interacting With Twitter

+ twitter

Gets the instance of the PF_Twitter object that Parse uses.

+ (nullable PF_Twitter *)twitter

Return Value

An instance of PF_Twitter object.

Declared In

PFTwitterUtils.h

+ initializeWithConsumerKey:consumerSecret:

Initializes the Twitter singleton.

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

Parameters

consumerKey

Your Twitter application’s consumer key.

consumerSecret

Your Twitter application’s consumer secret.

Discussion

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

Declared In

PFTwitterUtils.h

+ isLinkedWithUser:

Whether the user has their account linked to Twitter.

+ (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.

Declared In

PFTwitterUtils.h

Logging In & Creating Twitter-Linked Users

+ logInInBackground

Asynchronously logs in a user using Twitter.

+ (BFTask PF_GENERIC ( PFUser *) *)logInInBackground

Return Value

The task, that encapsulates the work being done.

Discussion

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.

Declared In

PFTwitterUtils.h

+ logInWithBlock:

Asynchronously logs in a user using Twitter.

+ (void)logInWithBlock:(nullable PFUserResultBlock)block

Parameters

block

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

Discussion

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.

Declared In

PFTwitterUtils.h

+ logInWithTwitterIdInBackground:screenName:authToken:authTokenSecret:

Asynchronously logs in a user using Twitter.

+ (BFTask PF_GENERIC ( PFUser *) *)logInWithTwitterIdInBackground:(NSString *)twitterId screenName:(NSString *)screenName authToken:(NSString *)authToken authTokenSecret:(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.

Discussion

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.

Declared In

PFTwitterUtils.h

+ logInWithTwitterId:screenName:authToken:authTokenSecret:block:

Logs in a user using Twitter.

+ (void)logInWithTwitterId:(NSString *)twitterId screenName:(NSString *)screenName authToken:(NSString *)authToken authTokenSecret:(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).

Discussion

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.

Declared In

PFTwitterUtils.h

Linking Users with Twitter

+ linkUser:

Asynchronously links Twitter to an existing PFUser. (Deprecated: Please use [PFTwitterUtils linkUserInBackground:] instead.)

+ (void)linkUser:(PFUser *)user

Parameters

user

User to link to Twitter.

Discussion

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

Declared In

PFTwitterUtils.h

+ linkUserInBackground:

Asynchronously links Twitter to an existing PFUser.

+ (BFTask PF_GENERIC ( NSNumber *) *)linkUserInBackground:(PFUser *)user

Parameters

user

User to link to Twitter.

Return Value

The task, that encapsulates the work being done.

Discussion

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

Declared In

PFTwitterUtils.h

+ linkUser:block:

Asynchronously links Twitter to an existing PFUser.

+ (void)linkUser:(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).

Discussion

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

Declared In

PFTwitterUtils.h

+ linkUserInBackground:twitterId:screenName:authToken:authTokenSecret:

Asynchronously links Twitter to an existing PFUser asynchronously.

+ (BFTask PF_GENERIC ( NSNumber *) *)linkUserInBackground:(PFUser *)user twitterId:(NSString *)twitterId screenName:(NSString *)screenName authToken:(NSString *)authToken authTokenSecret:(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.

Discussion

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

Declared In

PFTwitterUtils.h

+ linkUser:twitterId:screenName:authToken:authTokenSecret:block:

Asynchronously links Twitter to an existing PFUser.

+ (void)linkUser:(PFUser *)user twitterId:(NSString *)twitterId screenName:(NSString *)screenName authToken:(NSString *)authToken authTokenSecret:(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).

Declared In

PFTwitterUtils.h

Unlinking Users from Twitter

+ unlinkUser:

Synchronously unlinks the PFUser from a Twitter account.

+ (BOOL)unlinkUser:(PFUser *)user

Parameters

user

User to unlink from Twitter.

Return Value

Returns true if the unlink was successful.

Declared In

PFTwitterUtils.h

+ unlinkUser:error:

Synchronously unlinks the PFUser from a Twitter account.

+ (BOOL)unlinkUser:(PFUser *)user error:(NSError **)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.

Declared In

PFTwitterUtils.h

+ unlinkUserInBackground:

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

+ (BFTask PF_GENERIC ( NSNumber *) *)unlinkUserInBackground:(PFUser *)user

Parameters

user

User to unlink from Twitter.

Return Value

The task, that encapsulates the work being done.

Declared In

PFTwitterUtils.h

+ unlinkUserInBackground:block:

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

+ (void)unlinkUserInBackground:(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).

Declared In

PFTwitterUtils.h