Question

How come when you are using SLComposeViewController on iOS you only get 108 characters for your tweet instead of the usual 140?

Shown in the screenshot below... enter image description here

I am creating this SLComposeViewController using the following code...

- (IBAction)compose:(id)sender {
    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) {
        SLComposeViewController *composeViewController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
        [composeViewController addImage:[UIImage imageNamed:@"twitter_logo.png"]];
        [composeViewController setCompletionHandler:^(SLComposeViewControllerResult result) {
            if (result == SLComposeViewControllerResultDone) {
                UIAlertView *success = [[UIAlertView alloc] initWithTitle:@"Success" message:@"Your tweet was successfully posted!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
                [success show];
            }
            else {
                [self dismissViewControllerAnimated:YES completion:nil];
            }
        }];
        [self presentViewController:composeViewController animated:YES completion:nil];
    } else {
        UIAlertView *error = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Error" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [error show];
    }
}

What am I doing wrong?

Was it helpful?

Solution

I figured out why this was happening.

I didn't realize that [composeViewController addImage:[UIImage imageNamed:@"twitter_logo.png"]]; was technically posting a link to a picture in the tweet, like, http://pic.twitter.com/7Fsa2kadf so that was taking up 32 characters in the tweet.

If I comment out that line of code it is at 140 characters.

Maybe apple will display a link in future updates.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top