Is there anyway to open the twitter app from an html link on an iPhone? Kind of how when you click a youtube link it goes to the youtube app.
thanks
Is there anyway to open the twitter app from an html link on an iPhone? Kind of how when you click a youtube link it goes to the youtube app.
thanks
You'd use twitter://
as the URL and put it in an action for a button or something like so:
-(IBAction)openTwitter{
NSURL* url = [NSURL URLWithString:@"twitter://"];
[[UIApplication sharedApplication] openURL:url];
}
If you meant html on a website you'd use <a href="twitter://">tap me to go to twitter</a>
for the link.
URL Schemes are shown here and you can grab some more handy information about them too.
I'd probably recommend @Arab_Geek's solution though as it isn't that much of a trouble and it's giving back control to the user.
Why don't you use Twitter integratation for iOS 5 (TWTweetComposeViewController) ?
NSURL * twitterURL = [NSURL URLWithString:@"twitter://"];
if([[UIApplication sharedApplication] canOpenURL:twitterURL])
[[UIApplication sharedApplication] openURL:twitterURL];