TWTRTwitter Class Reference
Inherits from | NSObject |
---|---|
Declared in | TWTRTwitter.h |
Overview
The central class of the Twitter Kit.
Note: This class can only be used from the main thread.
+ sharedInstance
Returns the Twitter singleton.
+ (TWTRTwitter *)sharedInstance
Return Value
The Twitter singleton.
Declared In
TWTRTwitter.h
– startWithConsumerKey: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 *)consumerSecret
Parameters
consumerKey |
Your Twitter application’s consumer key. |
---|---|
consumerSecret |
Your Twitter application’s consumer secret. |
Declared In
TWTRTwitter.h
– startWithConsumerKey:consumerSecret:accessGroup:
Start Twitter with a consumer key, secret, and keychain access group. See [TWTRTwitter startWithConsumerKey:consumerSecret:]
- (void)startWithConsumerKey:(NSString *)consumerKey consumerSecret:(NSString *)consumerSecret accessGroup:(nullable NSString *)accessGroup
Parameters
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
TWTRTwitter.h
version
The current version of this kit.
@property (nonatomic, copy, readonly) NSString *version
Declared In
TWTRTwitter.h
authConfig
Authentication configuration details. Encapsulates the consumerKey
and consumerSecret
credentials required to authenticate a Twitter application.
@property (nonatomic, readonly) TWTRAuthConfig *authConfig
Declared In
TWTRTwitter.h
sessionStore
Session store exposing methods to fetch and manage active sessions. Applications that need to manage multiple users should use the session store to authenticate and log out users.
@property (nonatomic, readonly) TWTRSessionStore *sessionStore
Declared In
TWTRTwitter.h
– logInWithCompletion:
Triggers user authentication with Twitter.
- (void)logInWithCompletion:(TWTRLogInCompletion)completion
Parameters
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
TWTRTwitter.h
– logInWithViewController:completion:
Triggers user authentication with Twitter. Allows the developer to specify the presenting view controller.
- (void)logInWithViewController:(nullable UIViewController *)viewController completion:(TWTRLogInCompletion)completion
Parameters
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
TWTRTwitter.h
– 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 *)options
Parameters
application |
The |
---|---|
url |
The |
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
TWTRTwitter.h