Prompt login alert with Twitter framework in iOS5?

In iOS5.1, we should use TWTweetComposeViewController to show the dialog since apple rejects apps using prefs:root=TWITTER.

But, I didn’t like showing the tweet screen and keyboard
so I figured out the way to hide them, but show the pop up screen.

UPDATE:
Apple approved my app using this trick.

enter image description here

    TWTweetComposeViewController *viewController = [[TWTweetComposeViewController alloc] init];

    //hide the tweet screen
    viewController.view.hidden = YES;

    //fire tweetComposeView to show "No Twitter Accounts" alert view on iOS5.1
    viewController.completionHandler = ^(TWTweetComposeViewControllerResult result) {
        if (result == TWTweetComposeViewControllerResultCancelled) {            
            [self dismissModalViewControllerAnimated:NO];
        }
    };
    [self presentModalViewController:viewController animated:NO];

    //hide the keyboard
    [viewController.view endEditing:YES];

    //this approach doesn't work since you can't jump to settings
//    [self dismissModalViewControllerAnimated:NO];

Leave a Comment