PF_Twitter

@interface PF_Twitter : NSObject

The PF_Twitter class is a simple interface for interacting with the Twitter REST API, automating sign-in and OAuth signing of requests against the API.

  • Consumer key of the application that is used to authorize with Twitter.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSString *consumerKey;
  • Consumer secret of the application that is used to authorize with Twitter.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSString *consumerSecret;
  • Auth token for the current user.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSString *authToken;
  • Auth token secret for the current user.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSString *authTokenSecret;
  • Twitter user id of the currently signed in user.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSString *userId;
  • Twitter screen name of the currently signed in user.

    Declaration

    Objective-C

    @property (readwrite, copy, nonatomic, nullable) NSString *screenName;
  • Displays an auth dialog and populates the authToken, authTokenSecret, userId, and screenName properties if the Twitter user grants permission to the application.

    Declaration

    Objective-C

    - (nonnull BFTask *)authorizeInBackground;

    Return Value

    The task, that encapsulates the work being done.

  • Displays an auth dialog and populates the authToken, authTokenSecret, userId, and screenName properties if the Twitter user grants permission to the application.

    Declaration

    Objective-C

    - (void)authorizeWithSuccess:(nullable void (^)(void))success
                         failure:(nullable void (^)(NSError *_Nullable))failure
                          cancel:(nullable void (^)(void))cancel;

    Parameters

    success

    Invoked upon successful authorization.

    failure

    Invoked upon an error occurring in the authorization process.

    cancel

    Invoked when the user cancels authorization.

  • Adds a 3-legged OAuth signature to an NSMutableURLRequest based upon the properties set for the Twitter object.

    Use this function to sign requests being made to the Twitter API.

    Declaration

    Objective-C

    - (void)signRequest:(nullable NSMutableURLRequest *)request;

    Parameters

    request

    Request to sign.