Ad

Our DNA is written in Swift
Jump

Making a "Follow us on Twitter" button

I am working on the ultimate “About Page” component at the moment. And of course this won’t be complete without a button to follow the developer on Twitter. Tapbots is one company that has the best role model for modeling this. They have this little button here at the bottom of their about page:

There is something amazing that happened when I tapped on this “Follow us on Twitter” button: it opened up the tapbots user right in Tweetie 2! I was astonished at first, but then it dawned on me that on the iPhone you can have your app respond to a custom URL scheme and obviously some Twitter clients support going to the user’s profile page. I have only Tweetie 2 installed and incidently this supports just that.

There are a couple of pages dedicated to documenting the URL schemes but I get the impression since nobody is making any money by exposing his URL scheme very few people seem to bother. The sites I found dealing with URL Schemes are:

These are the twitter clients that a supposedly the most important ones and what their status is on following a specific user. If you have one or more of these installed please try it out by entering the URL in safari and see if the result is what it should be. By the same token if this information is incomplete or false please let me know.

  • Tweetie – (URI scheme) supports tweetie://user?screen_name=dr_touch
  • Twittelator – (URI scheme) supports twit:///user?screen_name=dr_touch
  • Tweetdeck – (no docs) has no support, URI only opens app.
  • Twitterific – (no docs) has no support (4), URI only opens app.
  • Birdfeed – (URI scheme) supports x-birdfeed://user?screen_name=dr_touch
  • Echofon – (URI scheme) supports: echofon:///user_timeline?dr_touch
  • SimplyTweet – (URI scheme) has no support, suggested workaround: simplytweet:?link=http://twitter.com/dr_touch
  • Twitbird – (URI scheme) has no support, URI only opens for posting.
  • Natsulion – (no docs) has no support, URI only opens app.
  • Tweeterena – (no docs) has no support (3), URI only opens app.
  • Tweetings – (URI scheme) supports tweetings:///user?screen_name=dr_touch
  • Tweeterville – (no docs) has no support (6), URI only opens app.
  • Twinkle – (no docs) has no support, URI only opens app.
  • Icebird – (URI scheme) supports icebird://user?screen_name=dr_touch
  • Fluttr – (no docs) supports fluttr://user/dr_touch

(3) Andrew Weekes promised to put it in a future version
(4) Anthony said it’s on their “list of things to consider adding”
(6) Dominic Wroblewski said it is has been added to the next version.

My dear fellow iPhone Developers, I am somewhat disappointed! Tweetie has by far the most complete feature set on it’s URL scheme. I think it is a useful, if not necessary addition to any twitter client to support showing a user page. I’d be happy to change the above list to include your added support for this feature.

Well, at least I found enough support so that I can get my code started. If you have any influence of any twitter app please tell it’s developers to add this support and tell me about it so that I can add it as well. 😉

- (void) openTwitterAppForFollowingUser:(NSString *)twitterUserName
{
	UIApplication *app = [UIApplication sharedApplication];
 
	// Tweetie: http://developer.atebits.com/tweetie-iphone/protocol-reference/
	NSURL *tweetieURL = [NSURL URLWithString:[NSString stringWithFormat:@"tweetie://user?screen_name=%@", twitterUserName]];
	if ([app canOpenURL:tweetieURL])
	{
		[app openURL:tweetieURL];
		return;
	}
 
	// Birdfeed: http://birdfeed.tumblr.com/post/172994970/url-scheme
	NSURL *birdfeedURL = [NSURL URLWithString:[NSString stringWithFormat:@"x-birdfeed://user?screen_name=%@", twitterUserName]];
	if ([app canOpenURL:birdfeedURL])
	{
		[app openURL:birdfeedURL];
		return;
	}
 
	// Twittelator: http://www.stone.com/Twittelator/Twittelator_API.html
	NSURL *twittelatorURL = [NSURL URLWithString:[NSString stringWithFormat:@"twit:///user?screen_name=%@", twitterUserName]];
	if ([app canOpenURL:twittelatorURL])
	{
		[app openURL:twittelatorURL];
		return;
	}
 
	// Icebird: http://icebirdapp.com/developerdocumentation/
	NSURL *icebirdURL = [NSURL URLWithString:[NSString stringWithFormat:@"icebird://user?screen_name=%@", twitterUserName]];
	if ([app canOpenURL:icebirdURL])
	{
		[app openURL:icebirdURL];
		return;
	}
 
	// Fluttr: no docs
	NSURL *fluttrURL = [NSURL URLWithString:[NSString stringWithFormat:@"fluttr://user/%@", twitterUserName]];
	if ([app canOpenURL:fluttrURL])
	{
		[app openURL:fluttrURL];
		return;
	}
 
	// SimplyTweet: http://motionobj.com/blog/url-schemes-in-simplytweet-23
	NSURL *simplytweetURL = [NSURL URLWithString:[NSString stringWithFormat:@"simplytweet:?link=http://twitter.com/%@", twitterUserName]];
	if ([app canOpenURL:simplytweetURL])
	{
		[app openURL:simplytweetURL];
		return;
	}
 
	// Tweetings: http://tweetings.net/iphone/scheme.html
	NSURL *tweetingsURL = [NSURL URLWithString:[NSString stringWithFormat:@"tweetings:///user?screen_name=%@", twitterUserName]];
	if ([app canOpenURL:tweetingsURL])
	{
		[app openURL:tweetingsURL];
		return;
	}
 
	// Echofon: http://echofon.com/twitter/iphone/guide.html
	NSURL *echofonURL = [NSURL URLWithString:[NSString stringWithFormat:@"echofon:///user_timeline?%@", twitterUserName]];
	if ([app canOpenURL:echofonURL])
	{
		[app openURL:echofonURL];
		return;
	}
 
	// --- Fallback: Mobile Twitter in Safari
	NSURL *safariURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://mobile.twitter.com/%@", twitterUserName]];
	[app openURL:safariURL];
}

And to test it put simple this code behind any button you would want to label “Follow us on Twitter”:

[self openTwitterAppForFollowingUser:@"dr_touch"];

I hope that over time more clients will adopt a method to get them to open a user page for following. For the time being we have to be satisfied with almost 3 clients supporting such a mechanism.


Categories: Recipes

8 Comments »

  1. Does this work for facebook fanpages as well?

  2. Is there a facebook app url scheme?

  3. I found the answer here, works with the official Facebook app

  4. Hi i want to open my app’s page in app store. i think it will follow the same method as above. Can anyone tell me what URL I ll give to do this?

Trackbacks

  1. iPhone SDK In App Social Links | de