I recommend you use the new iOS 6 API to interact with Twitter and Facebook. It makes it a lot easier. Here is the code to send a Tweet
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
{
SLComposeViewController *tweetSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
tweetSheet.completionHandler = ^(SLComposeViewControllerResult result) {
switch(result)
{
case SLComposeViewControllerResultCancelled:
break;
// This means the user hit 'Cancel'
case SLComposeViewControllerResultDone:
// This means the user hit 'Send'
break;
}
// dismiss the Tweet Sheet
dispatch_async(dispatch_get_main_queue(), ^{
[self dismissViewControllerAnimated:NO completion:^{
NSLog(@"Tweet Sheet has been dismissed.");
}];
});
};
[tweetSheet setInitialText:@"Tweeting from my own app! :)"];
[self presentViewController:tweetSheet animated:YES completion:NULL];
}
else
{
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"Sorry"
message:@"You can't send a tweet right now, make sure\
your device has an internet connection and you have\
at least one Twitter account setup"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alertView show];
}