SLComposeViewController中的108个字符

时间:2013-06-24 16:51:39

标签: ios objective-c twitter slcomposeviewcontroller

为什么在iOS上使用SLComposeViewController时,你的推文只能获得108个字符而不是通常的140个字符?

如下面的屏幕截图所示...... enter image description here

我正在使用以下代码创建此SLComposeViewController ...

- (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];
    }
}

我做错了什么?

1 个答案:

答案 0 :(得分:3)

我弄清楚为什么会这样。

我没有意识到[composeViewController addImage:[UIImage imageNamed:@"twitter_logo.png"]];在技术上发布了推文中图片的链接,例如 http://pic.twitter.com/7Fsa2kadf 在推文中占据了32个字符。

如果我注释掉那行代码,则为140个字符。

也许苹果会在未来的更新中显示链接。