Kirk Ouimet
Kirk Ouimet

Reputation: 28414

How do I open a user's Twitter profile using the Twitter app using a link in Mobile Safari?

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?

Upvotes: 9

Views: 5828

Answers (4)

beryllium
beryllium

Reputation: 29767

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

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

Upvotes: 28

Rafael Sanches
Rafael Sanches

Reputation: 1823

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.

Upvotes: 1

SimplyKiwi
SimplyKiwi

Reputation: 12444

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?

Upvotes: 2

Jonah
Jonah

Reputation: 17958

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.

Upvotes: 4

Related Questions