Reputation: 690
I am developing a application in which I have integrated Twitter by using these Twitter-Oath-iPhone. These library are working fine on lower version then ios 5 how can I use the twitter in ios 5. I don't know either Twitter change in there API or apple have make any change in ios 5.
Upvotes: 1
Views: 407
Reputation: 690
Try by replace this Function in "SA_OAuthTwitterEngine.m"
- (SA_OAuthTwitterEngine *) initOAuthWithDelegate: (NSObject *) delegate {
if (self = (id) [super initWithDelegate: delegate]) {
self.requestTokenURL = [NSURL URLWithString: @"http://twitter.com/oauth/request_token"];
self.accessTokenURL = [NSURL URLWithString: @"http://twitter.com/oauth/access_token"];
self.authorizeURL = [NSURL URLWithString: @"http://twitter.com/oauth/authorize"];
}
return self;
}
in place of this code use this one
- (SA_OAuthTwitterEngine *) initOAuthWithDelegate: (NSObject *) delegate {
if (self = (id) [super initWithDelegate: delegate]) {
self.requestTokenURL = [NSURL URLWithString: @"https://api.twitter.com/oauth/request_token"];
self.accessTokenURL = [NSURL URLWithString: @"https://api.twitter.com/oauth/access_token"];
self.authorizeURL = [NSURL URLWithString: @"https://api.twitter.com/oauth/authorize"];
}
return self;
}
this one slove my problem........
Upvotes: 1
Reputation: 20541
you can also use this code with inbuilt framework of Twiiter in iOS5.....
just add Twitter.framework
from your build library
and then just import bellow header file in your viewcontroller.h file
#import <Twitter/TWTweetComposeViewController.h>
afetr that when you want to share your message on twitter just use bellow code in viewcontroller.m file again just import
#import <Twitter/TWTweetComposeViewController.h>
.....
- (IBAction)shareOnTwitter:(id)sender {
TWTweetComposeViewController *twitter = [[TWTweetComposeViewController alloc] init];
[twitter setInitialText:@"It's really that simple!"];
[twitter addImage:[UIImage imageNamed:@"yourimage.jpg"]];//if required
[twitter addURL:[NSURL URLWithString:@"your url link"]];//if required
[self presentViewController:twitter animated:YES completion:nil];
twitter.completionHandler = ^(TWTweetComposeViewControllerResult res) {
if(res == TWTweetComposeViewControllerResultDone)
{
UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:@"Succes!" message:@"Your Tweet was posted succesfully" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
}else if(res == TWTweetComposeViewControllerResultCancelled)
{
UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:@"Canceled" message:@"Your Tweet was not posted" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
}
[self dismissModalViewControllerAnimated:YES];
};
}
May this Help you and this code is may b not work in simulator sometime so test it in device.....
Upvotes: 0
Reputation: 1282
There is a very easy way in ios-5 for twitter integration, just add Twitter framework and use this code. Link is below.
Upvotes: 0
Reputation: 79
For twitter integration in ios 5 its very easy , because of new framework added in ios 5 onwards just follow there steps: 1. add twitter.framework 2. follow from twitter official site
Upvotes: 0
Reputation: 8053
you used API well work in IOS 5 only minor change in "SA_OAuthTwitterEngine.m"
class
Replace this Function in "SA_OAuthTwitterEngine.m"
class
- (SA_OAuthTwitterEngine *) initOAuthWithDelegate: (NSObject *) delegate
{
if (self = (id) [super initWithDelegate: delegate]) {
self.requestTokenURL = [NSURL URLWithString: @"https://twitter.com/oauth/request_token"];
self.accessTokenURL = [NSURL URLWithString: @"https://twitter.com/oauth/access_token"];
self.authorizeURL = [NSURL URLWithString: @"https://twitter.com/oauth/authorize"];
}
return self;
}
Upvotes: 2
Reputation: 9481
Twitter integration for iOS 5 Tutorial:
One of the exciting new features in iOS 5 is Twitter integration. Photos, YouTube, Safari, and Maps come fully integrated. With most iOS 5 users jumping on the Twitter bandwagon (Twitter daily signups tripled, according to Twitter’s CEO), allowing your users to tweet about your app could help put it in front of more people. In this iDevBlogADay post, I want to write a tutorial for integrating your app with Twitter.
Upvotes: 0