A tweet can be opened by Safari with a link of this format:
http://twitter.com/1Direction_X/statuses/197752514391715842
On iOS 5, Twitter is built-in. How can I open the above tweet using the native Twitter app called from my app?
A tweet can be opened by Safari with a link of this format:
http://twitter.com/1Direction_X/statuses/197752514391715842
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?id=12345
twitter://status?id=12345
twitter://timeline
twitter://mentions
twitter://messages
twitter://list?screen_name=lorenb&slug=abcd
twitter://post?message=hello%20world
twitter://post?message=hello%20world&in_reply_to_status_id=12345
twitter://search?query=%23hashtag
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://"]];
?message=hello%20world&media_ids= 471592142565957632
but to use mediaIDs you still need to manage uploading content directly to Twitter. I think the easiest way would be to use a more open service like imgur to upload the photo in the background, then grab the link, add it to the tweet, then activate the URL scheme. I don't think Twitter's image service is very open. –
Rusk twitter://post?message=XXX
In today's world, its much better to trigger the iOS Twitter Share sheet instead and post without leaving the app. –
Rusk twitter://post?message=hello%20world&media_id=4324324
–
Fluorescence I would go with below approach...
NSURL *twitterURL = [NSURL URLWithString:@"fb://profile/<profile_id>"];
if ([[UIApplication sharedApplication] canOpenURL:twitterURL]) {
[[UIApplication sharedApplication] openURL:twitterURL];
} else {
WebViewViewController *secondView = [self.storyboard instantiateViewControllerWithIdentifier:@"webinterface"];
secondView.headerLabel = @"Facebook";
secondView.webPath = @"https://www.facebook.com/pages/<link_for_page>";
[self.navigationController pushViewController:secondView animated:YES];
}
in WebViewViewController
I have webview and I am opening link there...
basically its like if you don't have Twitter on iPhone, it will open in WebView...
My apologies if this has already been answered, but the schema for posting a message with a hashtag is:
twitter://post?message=hello%20world%23thisisyourhashtag.
Just replace thisisyourhashtag
with the hashtag that you would like users to post.
%23
. –
Beanpole © 2022 - 2024 — McMap. All rights reserved.