iOS 5 Twitter Framework Integration
One of the new features in iOS 5 that will save you a lot of time is the Twitter integration.
The first thing you need to do is add the Twitter framework to your project.
Then include the Twitter header file in your header
#import Twitter/Twitter.hNext you need to create a TWTweetComposeViewController and set the text/link/image that you want to share.
TWTweetComposeViewController *tweetSheet = [[TWTweetComposeViewController alloc] init ]; [tweetSheet setInitialText:@"Tweet Text"]]; [tweetSheet addImage:[UIImage imageNamed:@"yourimage"]]; [tweetSheet addURL:[NSURL URLWithString:@"http://www.jamie.co.za"]]; tweetSheet.completionHandler = ^(TWTweetComposeViewControllerResult result) { [self dismissModalViewControllerAnimated:YES]; }; [self presentModalViewController:tweetSheet animated:YES];
Thats all there is to it, simple and quick.
There is also a canSendTweet function you can call to detect if the user has a twitter account setup on the device. The completionHandler will be called once the tweet has been sent.



