Chapter 20

Tweeting with Twitter

Social media integration is not something that most apps can ignore. These days social media integration in apps is the norm rather than the exception. Fortunately for you, starting from iOS 5, Apple has built Twitter integration into the operating system. Sending tweets has never been easier!

In this lesson you learn to integrate the new Twitter framework in your iOS apps and allow the user to send tweets from your apps. You can build more complex Twitter clients that can access the entire Twitter API, but that topic is beyond the scope of this book.

The Twitter framework is not included in any of the standard iOS project templates that you use when creating a new project. You will need to add a reference to this framework manually. You can do this from the Project Settings page in Xcode. Select the project node in the project navigator to display the settings page. On the settings page, select the build target and switch to the Build Phases tab. Click the plus (+) button under the Link Binary With Libraries category and select Twitter.framework from the list of available frameworks (Figure 20-1).

The Tweet Sheet

The Twitter framework provides a tweet sheet that you should use in your apps if all you want is a simple “send tweet” feature. The tweet sheet is an instance of the TWTwitterComposerViewController class and provides a convenient ...

Get iPhone and iPad App 24-Hour Trainer now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.