Twitter Class Reference
| Inherits from | NSObject |
| Declared in | Twitter.h |
Overview
The central class of the Twitter Kit.
Note: This class can only be used from the main thread.
Tasks
-
+ sharedInstance -
– startWithConsumerKey:consumerSecret: -
– startWithConsumerKey:consumerSecret:accessGroup: -
versionproperty -
authConfigproperty -
sessionStoreproperty -
– logInWithCompletion: -
– logInWithMethods:completion: -
– logInWithViewController:completion: -
– logInWithViewController:methods:completion: -
– application:openURL:options:
Properties
authConfig
Authentication configuration details. Encapsulates the consumerKey and consumerSecret credentials required to authenticate a Twitter application.
@property (nonatomic, readonly) TWTRAuthConfig *authConfigDeclared In
Twitter.hInstance Methods
application:openURL:options:
Finish the SFSafariViewController authentication loop. This method should
be called from application:openURL:options inside the application delegate.
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *)optionsParameters
- application
The
UIApplicationinstance received as a parameter.
- url
The
NSURLinstance received as a parameter.
- options
The options dictionary received as a parameter.
Return Value
Boolean specifying whether this URL was handled by Twitter Kit or not.
Discussion
This method will verify an authentication token sent by the Twitter API to finish the web-based authentication flow.
Declared In
Twitter.hlogInWithCompletion:
Triggers user authentication with Twitter.
- (void)logInWithCompletion:(TWTRLogInCompletion)completionParameters
- completion
The completion block will be called after authentication is successful or if there is an error.
Discussion
This method will present UI to allow the user to log in if there are no saved Twitter login credentials. This method is equivalent to calling loginWithMethods:completion: with TWTRLoginMethodAll.
Warning: This method requires that you have set up your consumerKey and consumerSecret.
Declared In
Twitter.hlogInWithMethods:completion:
Triggers user authentication with Twitter.
- (void)logInWithMethods:(TWTRLoginMethod)methods completion:(TWTRLogInCompletion)completionParameters
- completion
The completion block will be called after authentication is successful or if there is an error.
Discussion
This method will attempt to log the user in based on the specified log in methods. If multiple methods are specified the system account method will be attempted first.
Warning: This method requires that you have set up your consumerKey and consumerSecret.
Declared In
Twitter.hlogInWithViewController:completion:
Triggers user authentication with Twitter. Allows the developer to specify the presenting view controller.
- (void)logInWithViewController:(nullable UIViewController *)viewController completion:(TWTRLogInCompletion)completionParameters
- viewController
The view controller that will be used to present the authentication view.
- completion
The completion block will be called after authentication is successful or if there is an error.
Discussion
This method will present UI to allow the user to log in if there are no saved Twitter login credentials.
Warning: This method requires that you have set up your consumerKey and consumerSecret.
Declared In
Twitter.hlogInWithViewController:methods:completion:
Triggers user authentication with Twitter. Allows the developer to specify the presenting view controller.
- (void)logInWithViewController:(nullable UIViewController *)viewController methods:(TWTRLoginMethod)methods completion:(TWTRLogInCompletion)completionParameters
- viewController
The view controller that will be used to present the authentication view.
- completion
The completion block will be called after authentication is successful or if there is an error.
Discussion
This method will attempt to log the user in based on the specified log in methods. If multiple methods are specified the system account method will be attempted first.
Warning: This method requires that you have set up your consumerKey and consumerSecret.
Declared In
Twitter.hstartWithConsumerKey:consumerSecret:
Start Twitter with your consumer key and secret. These will override any credentials present in your applications Info.plist.
- (void)startWithConsumerKey:(NSString *)consumerKey consumerSecret:(NSString *)consumerSecretParameters
- consumerKey
Your Twitter application’s consumer key.
- consumerSecret
Your Twitter application’s consumer secret.
Discussion
You do not need to call this method unless you wish to provide credentials other than those in your Info.plist.
Declared In
Twitter.hstartWithConsumerKey:consumerSecret:accessGroup:
Start Twitter with a consumer key, secret, and keychain access group. See [Twitter startWithConsumerKey:consumerSecret:]
- (void)startWithConsumerKey:(NSString *)consumerKey consumerSecret:(NSString *)consumerSecret accessGroup:(nullable NSString *)accessGroupParameters
- consumerKey
Your Twitter application’s consumer key.
- consumerSecret
Your Twitter application’s consumer secret.
- accessGroup
An optional keychain access group to apply to session objects stored in the keychain.
Discussion
Note: In the majority of situations applications will not need to specify an access group to use with Twitter sessions. This value is only needed if you plan to share credentials with another application that you control or if you are using TwitterKit with an app extension.
Declared In
Twitter.h