Launching the Twitter App to a Profile, With Web Fallback
To give users of your iOS app the option to follow you on twitter, you could open the webpage of your app account. Better yet, why not just open the Twitter app itself? Most twitter users probably have the official client installed. Using the custom url scheme supported by the Twitter app, you can display your account profile directly. Users are now only one tap away from following you.
The following URL will open the app on the @app_devs profile page:
1
twitter://user?screen_name=app_devs
A reusable piece of code:
12345678910111213141516
-(BOOL)openTwitterProfile:(NSString*)profileName{BOOLdidOpenApp=NO;UIDevice*device=[UIDevicecurrentDevice];NSString*profileURLString=[NSStringstringWithFormat:@"twitter://user?screen_name=%@",profileName];didOpenApp=[[UIApplicationsharedApplication]openURL:[NSURLURLWithString:profileURLString]];if(!didOpenOtherApp){// fallback to SafariNSString*profileURLString=[NSStringstringWithFormat:@"https://twitter.com/%@",profileName];didOpenApp=[[UIApplicationsharedApplication]openURL:[NSURLURLWithString:profileURLString]];}returndidOpenApp;}