Opening the Twitter App is pretty much the same as opening the Facebook App discussed earlier, just the URL scheme is different.
This is how we open Twitter so people can follow the user (me in this case, versluis). If the call is unsuccessful, we’ll try to open the Twitter page in Safari. And if that doesn’t work, we’ll display a log message:
- (IBAction)openTwitter:(id)sender { // open the Twitter App if (![[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"twitter://user?screen_name=versluis"]]) { // opening the app didn't work - let's open Safari if (![[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://twitter.com/versluis"]]) { // nothing works - perhaps we're not onlye NSLog(@"Nothing works. Punt."); } } }
To find out which other apps you can opened, and to figure out what scheme they follow:
To register a Custom URL Scheme in your own app: