MLTwitterUtils Class Reference

Inherits from NSObject
Declared in MLTwitterUtils.h

Overview

Provides utility functions for working with Twitter in a MaxLeap application.

This class is currently for iOS only.

Interacting With Twitter

+ twitter

Gets the instance of the Twitter object that MaxLeap uses.

+ (nullable ML_Twitter *)twitter

Return Value

The Twitter instance.

Declared In

MLTwitterUtils.h

+ initializeWithConsumerKey:consumerSecret:

Initializes the Twitter singleton. You must invoke this in order to use the Twitter functionality in MaxLeap.

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

Parameters

consumerKey

Your Twitter application’s consumer key.

consumerSecret

Your Twitter application’s consumer secret.

Declared In

MLTwitterUtils.h

+ isLinkedWithUser:

Whether the user has their account linked to Twitter.

+ (BOOL)isLinkedWithUser:(nullable MLUser *)user

Parameters

user

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

Return Value

True if the user has their account linked to Twitter.

Declared In

MLTwitterUtils.h

Logging In & Creating Twitter-Linked Users

+ logInWithBlock:

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 MLUser.

+ (void)logInWithBlock:(nullable MLUserResultBlock)block

Parameters

block

The block to execute. The block should have the following argument signature: (MLUser user, NSError error)

Declared In

MLTwitterUtils.h

+ logInWithTwitterId:screenName:authToken:authTokenSecret:block:

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 MLUser.

+ (void)logInWithTwitterId:(NSString *)twitterId screenName:(NSString *)screenName authToken:(NSString *)authToken authTokenSecret:(NSString *)authTokenSecret block:(nullable MLUserResultBlock)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. The block should have the following argument signature: (MLUser user, NSError error)

Declared In

MLTwitterUtils.h

Linking Users with Twitter

+ linkUser:block:

Links Twitter to an existing MLUser. This method delegates to Twitter to authenticate the user, and then automatically links the account to the MLUser.

+ (void)linkUser:(MLUser *)user block:(nullable MLBooleanResultBlock)block

Parameters

user

User to link to Twitter.

block

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

Declared In

MLTwitterUtils.h

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

Links Twitter to an existing MLUser. Allows you to handle user login to Twitter, then provide authentication data to link the account to the MLUser.

+ (void)linkUser:(MLUser *)user twitterId:(NSString *)twitterId screenName:(NSString *)screenName authToken:(NSString *)authToken authTokenSecret:(NSString *)authTokenSecret block:(nullable MLBooleanResultBlock)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. The block should have the following argument signature: (BOOL success, NSError error)

Declared In

MLTwitterUtils.h

Unlinking Users from Twitter

+ unlinkUserInBackground:block:

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

+ (void)unlinkUserInBackground:(MLUser *)user block:(nullable MLBooleanResultBlock)block

Parameters

user

User to unlink from Twitter.

block

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

Declared In

MLTwitterUtils.h