Upgrading

Upgrade to Twitter Kit 3.0

Note

It is important to note that Twitter Kit 3.0 supports iOS 9+. Please do not upgrade to Twitter Kit 3.0 if your project needs to be built for iOS versions less than 9.0.

Note

With Twitter Kit 3.0, changes have been made to how Twitter API keys are managed. Please refer to Upgrading from Fabric for details.

Twitter Kit 3.0 includes a number of new, changed, and removed methods that must be taken into consideration when upgrading from 2.x. The sections below outline these changes. A full list of changes can be viewed in the changelog.

Twitter Kit Initialization

  • [Removed] You don’t need to add Fabric in Podfile to install Twitter Kit.
  • [Removed] [Fabric with:@[[Twitter class]]] or Fabric.with([Twitter.self]) is no longer supported. Instead, use your application key and secret directly on AppDelegate. See installation for more information.

Simplification of Log in methods

  • [Removed] The methods -[Twitter logInWithMethods:completion:] and -[Twitter logInWithViewController:methods:completion:] have been simplified to -[Twitter logInWithCompletion:] -[Twitter logInWithViewController:completion:]. There is no longer any need to specify TWTRLoginMethods since the login methods in Twitter Kit 3 support all relevant Twitter API permissions (including email, if your app has enabled it.) Further, Twitter Kit 3.0 handles authorizing multiple additional Twitter accounts automatically via the Twitter app and improved web view behavior.
  • [Removed] The TWTRLoginMethod enum has been removed since it is no longer required for handling special cases of login. See log-in-with-twitter for more information.

Additional properties for search timeline

  • [New] The TWTRSearchTimelineDataSource topTweetsOnly property was replaced with the resultType property to expose more options to control search filtering. The new options are recent, popular, or mixed. Choosing popular is equal to the old topTweets option, and mixed is the default. See the `Search API documentation<https://dev.twitter.com/rest/public/search>`_ for more information.

Deprecation of TWTRComposer

  • [Removed] The TWTRComposer was deprecated in favor of TWTRComposerViewController, which now supports composing Tweets with image or video attachments. See compose-tweets for more info.

Removal of Tweet detail view for full linkified Tweet view

  • [New] Version 3.0 allows users to click hashtags, cashtags, and mentions within TWTRTweetView. When they click those entities, it will open up in Twitter app or in Safari if it is not installed. This will give users more context for the Tweets they see.
  • [Removed] The TWTRTweetDetailViewController was removed along with its delegate. Instead, you can implement [TWTRTweetViewDelegate] tweetView:didTapTweet which allows developers to customize the default implementation or provide their own behavior for tapping a Tweet.

Upgrade to Twitter Kit 2.0

Note

It is important to note that Twitter Kit 2.0 supports iOS 8+. Please do not upgrade to Twitter Kit 2.0 if your project needs to be built for iOS versions less than 8.0.

Twitter Kit 2.0 includes a number of new and deprecated methods that must be taken into consideration when upgrading from 1.x. The sections below outlines these changes. A full list of changes can be viewed in the changelog.

Requesting user email

  • [Removed] The TWTRShareEmailViewController class has been removed from Twitter Kit in version 2.0. If you still require access to the email address associated with the account you must use the web based OAuth login flow and request the email address via the verify_credentials endpoint, see Request User Email Address for more information. When the user is presented with the web based authentication flow they will be shown which permissions the application is requesting.

Removal of deprecated methods on Twitter instance

  • [Removed] Guest authentication methods were removed from the Twitter instance because the guest authentication logic is now automatically handled by Twitter Kit. If you still need to manage guest authentication on your own see Guest Authentication for more information.
  • [Removed] The -[Twitter logInWithExistingAuthToken:authTokenSecret:completion:] was removed from the Twitter instance. If you want to migrate existing OAuth tokens use the -[TWTRSessionStore saveSession:completion:] method instead.
  • [Removed] The APIClient property was removed from the Twitter instance. An APIClient can be instantiated directly without the need to use the shared instance. See Construct a Twitter API Client for more information.
  • [Removed] The logOut method and session property were removed from the Twitter instance, use the methods that are available on the TWTRSessionStore instead.

TWTRTweetView delegate methods

  • [New] Version 2.0 removed several delegate methods from the TWTRTweetViewDelegate protocol. Most of the methods that were removed were used for metrics related purposes and did not provide any mechanism for overriding functionality. These methods have been replaced in favor of NSNotifications which will allow developers to isolate their metrics logic from their controller logic.
  • [New] The notable exception to this is the removal of the -[TWTRTweetViewDelegate tweetView:didSelectTweet:] method. This method was replaced with -[TWTRTweetViewDelegate tweetView:shouldDisplayDetailViewController:] method which provides more value by allowing developers to customize the default implementation or provide their own behavior. If this method is not implemented a modal view controller will be presented when a Tweet view is tapped. If it is implemented developers can decide whether the detail view controller should be presented; if the delegate method returns YES the view controller will be presented but if NO is returned the view controller will not be presented and the developer can proceed however they want. For more information see Show Standalone Tweets in a Detailed View for more information.