9

It looks like Twitter registers the URI scheme of twitter://, but after playing around with it I can't get it to directly open a user's profile. I've tried:

twitter://username
twitter://user/username
twitter://profile/username

with no luck. I'll need it to work on Android as well.

Thoughts?

Kirk Ouimet
  • 27,280
  • 43
  • 127
  • 177

4 Answers4

28

I found two URL schemes for twitter tweetie:// and twitter://:

tweetie:///user?screen_name=jessicaalba
twitter:///user?screen_name=jessicaalba

On this wiki site you can find a lot of other iphone url schemes (including twitter)

beryllium
  • 29,669
  • 15
  • 106
  • 125
  • This is right. This site is also a great source for custom app schemes : http://handleopenurl.com/scheme/twitter – yonel Nov 20 '11 at 21:56
  • Ironically/unfortunately that handleopenurl.com is no longer available :( – Nick Jan 21 '18 at 23:18
4

Doesn't seem to be official documented anywhere so I wouldn't count on all versions of the Twitter app supporting it but http://groups.google.com/group/twitter-development-talk/browse_thread/thread/92b958b7af002993?pli=1 gives a hint that might be worth a try:

I just found that "twitter:///user?screen_name=tvdw" works as well.

Jonah
  • 17,918
  • 1
  • 43
  • 70
2

I know you are looking specifically to open it up with the official Twitter app but what if the person doesn't have the app, then the functionality will not work in your app.

Why not just use MGTwitterEngine in this case since it will work for everyone and it will remain in your app?

SimplyKiwi
  • 12,376
  • 22
  • 105
  • 191
1

For those wondering how to test if the scheme executes:

- (BOOL)openURL:(NSString *)url
- (void) clickTwitter {
    if (![self openURL:@"twitter:///user?screen_name=mufumbo"]) {
        if (![self openURL:@"tweetie:///user?screen_name=mufumbo"]) {
            [self openURL:@"http://twitter.com/mufumbo"];   
        }
    }
}

you can include many more and make it a generic loop.

Rafael Sanches
  • 1,823
  • 21
  • 28