0

我正在 xCode 中创建一个程序,基本上可以让您在 Twitter 上发布一些内容。一切正常,除了我试图想办法发布一个超文本,这会导致说谷歌。例如,当我单击它时,我希望单词 wwww.google.com 能够引导至 google。任何帮助都将不胜感激。谢谢

这是代码

-(void)tweetTapped{
    if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter])
    {
        SLComposeViewController *tweetSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
        [tweetSheet setInitialText:@"Post to Twitter :) www.google.com"];


        [self presentViewController:tweetSheet animated:YES completion:nil];
    }
    else
    {
        UIAlertView *alertView = [[UIAlertView alloc]
                                  initWithTitle:@"Sorry"
                                  message:@"You can't send a tweet right now, make sureyour device has an internet connection and you haveat least one Twitter account setup"
                                  delegate:self
                                  cancelButtonTitle:@"OK"
                                  otherButtonTitles:nil];
        [alertView show];
    }
}
4

1 回答 1

2

您不能在推文中使用超文本,但如果您包含 URL,则 Twitter 应该会自动为您链接。Twitter 通常也会使用 URL 缩短器。所以只需使用这样的格式:

NSString *tweet = @"This is a link to http://google.com";
于 2013-05-25T18:55:59.080 回答