【问题标题】:Open Twitter app in html在 html 中打开 Twitter 应用程序
【发布时间】:2012-06-13 15:34:49
【问题描述】:

是否可以从 iPhone 上的 html 链接打开 twitter 应用程序?当您单击 youtube 链接时,它会如何转到 youtube 应用程序。

谢谢

【问题讨论】:

标签: iphone html


【解决方案1】:

您可以使用twitter:// 作为 URL 并将其放入按钮或类似操作的操作中:

-(IBAction)openTwitter{
   NSURL* url = [NSURL URLWithString:@"twitter://"];
   [[UIApplication sharedApplication] openURL:url];   
}

如果您指的是网站上的 html,您可以使用 <a href="twitter://">tap me to go to twitter</a> 作为链接。

URL Schemes 显示为here,您也可以获取一些更方便的信息。

我可能会推荐@Arab_Geek 的解决方案,因为它不是那么麻烦,而且它会将控制权交还给用户。

【讨论】:

    【解决方案2】:

    为什么不使用 iOS 5 的 Twitter 集成 (TWTweetComposeViewController)?

    【讨论】:

      【解决方案3】:
      NSURL * twitterURL = [NSURL URLWithString:@"twitter://"];
      if([[UIApplication sharedApplication] canOpenURL:twitterURL])
          [[UIApplication sharedApplication] openURL:twitterURL];
      

      【讨论】:

      • 我说的是html,不是objective-c
      猜你喜欢
      • 1970-01-01
      • 2023-03-24
      • 2022-12-17
      • 2012-02-16
      • 1970-01-01
      • 2016-11-22
      • 1970-01-01
      • 2015-12-11
      • 1970-01-01
      相关资源
      最近更新 更多