如何使用iOS上的原生Twitter应用程序打开Twitter推文? [英] How can I open a Twitter tweet using the native Twitter app on iOS?
问题描述
Safari可以使用以下格式的链接打开推文:
A tweet can be opened by Safari with a link of this format:
http://twitter.com/1Direction_X/statuses/197752514391715842
在iOS 5上,Twitter是内置的。如何使用从我的应用程序调用的本机Twitter应用程序打开上述推文?
On iOS 5, Twitter is built-in. How can I open the above tweet using the native Twitter app called from my app?
推荐答案
这是您访问其他应用程序的方式你自己。只需找到要发送的正确网址即可访问状态。我已经列出了一个应该包含大多数重要列表的列表。包括状态查找。
This is how you access other apps from your own. Just find the proper url to send for accessing status. I've included a list that should have most of the important ones. Including status finding.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"twitter://status?id=12345"]];
twitter:// user?screen_name = lorenb
twitter://user?screen_name=lorenb
twitter:// user?id = 12345
twitter://user?id=12345
twitter:// status?id = 12345
twitter://status?id=12345
twitter:// timeline
twitter://timeline
twitter://提及
twitter://mentions
twitter: //消息
twitter://messages
twitter:// list?screen_name = lorenb& slug = abcd
twitter://list?screen_name=lorenb&slug=abcd
twitter:// post?message = hello%20world
twitter://post?message=hello%20world
twitter:// post?message = hello%20world& in_reply_to_status_id = 12345
twitter://post?message=hello%20world&in_reply_to_status_id=12345
twitter:// search?query =%23hashtag
twitter://search?query=%23hashtag
注意:制作这一点非常重要确保用户安装了twitter,否则会导致崩溃。所以我建议在你尝试将它们发送到twitter之前在if语句中添加它。
Note: It can be important to make sure the user has twitter installed or this will cause a crash. So I recommend adding this in an if statement before you try to send them to twitter.
[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"twitter://"]];
这篇关于如何使用iOS上的原生Twitter应用程序打开Twitter推文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!