Hello Guyz, In this section i will show you the two different way to integrate "Follow us on Twitter" button from inside our iOS App. If you are a twitter user then you probably got what i am talking about. "Follow us" button is very popular in web apps, by integrating it we can directly follow some people or organization depending on the twitter screen name we choose to follow and in this section i will show you how we can integrate it from inside our iOS apps.
Method 1: Without using any API
Without plugging into native twitter app or using any other API in code, we could simple open a URL to do the job of Following some one in twitter.
-(IBAction)FollowUsOnTwitter:(id)sender {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://twitter.com/intent/user?screen_name=%@",TwitterAccountName]]];
}
Note : TwitterAccountName = your twitter account name you wish to follow, and it will open to follow that account in the browser.
Method 2: Using Twitter Framework for iOS 5 and later
To be noted here is that Twitter framework is available only for iOS 5 and later version.
- First of all , add "Twitter.framework" and "Accounts.framework" to your project.
- now include #import <Accounts/Accounts.h> and #import <Twitter/Twitter.h> to your .h file.