Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/94.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
从iOS应用程序推特链接_Ios_Twitter_Slcomposeviewcontroller - Fatal编程技术网

从iOS应用程序推特链接

从iOS应用程序推特链接,ios,twitter,slcomposeviewcontroller,Ios,Twitter,Slcomposeviewcontroller,我正在用xCode创建一个程序,基本上可以让你在twitter上发布一些东西。一切都正常,除了我试图找到一种方法来发布一条超文本,这将导致人们说谷歌。 例如,当我点击WW.google.com这个词时,我希望它能指向谷歌。任何帮助都将不胜感激。谢谢 这是密码 -(void)tweetTapped{ if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) { SLCo

我正在用xCode创建一个程序,基本上可以让你在twitter上发布一些东西。一切都正常,除了我试图找到一种方法来发布一条超文本,这将导致人们说谷歌。 例如,当我点击WW.google.com这个词时,我希望它能指向谷歌。任何帮助都将不胜感激。谢谢

这是密码

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

你不能在tweet中使用超文本,但如果你包含一个URL,它应该通过Twitter自动为你链接。Twitter通常也会使用URL缩短器。因此,只需使用如下格式:

NSString *tweet = @"This is a link to http://google.com";