I am developing a Twitter client for Mac OSX and I am using MgTwitter framework. I use xAuth login method and it works fine but I can't get tweets from my timeline.
Here is the error message in the console:
+[OARequestParameter requestParameter:value:]: unrecognized selector sent to class
And here is the code for login method and the functions to manage the token element:
- (void)startTwitter {
NSLog(@"Starting twitter connection...");
NSString *consumerKey = @"***************";
NSString *consumerSecret = @"*********";
twitterEngine = [[MGTwitterEngine alloc] initWithDelegate:self];
[twitterEngine setUsesSecureConnection:NO];
[twitterEngine setConsumerKey:consumerKey secret:consumerSecret];
[twitterEngine setUsername:user];
// xAuth method
[twitterEngine getXAuthAccessTokenForUsername:user password:password];
// update timeline
[self updateTwitterBuffer];
} // startTwitter
- (void) updateTwitterBuffer {
NSLog(@"Updating timeline.");
[twitterEngine getHomeTimelineSinceID:0 startingAtPage:0 count:20];
[twitterEngine getDirectMessagesSinceID:0 startingAtPage:0];
[twitterEngine getSentDirectMessagesSinceID:0 startingAtPage:0];
} // updateTwitterBuffer
- (void) stopTwitter {
[twitterEngine release];
[token release];
} // stopTwitter
- (void)accessTokenReceived:(OAToken *)aToken forRequest:(NSString *)connectionIdentifier {
NSLog(@"Access token received! %@",aToken);
token = [aToken retain];
[twitterEngine setAccessToken:token];
} // accessTokenReceived
I don't know where the error is. How can I开发者_JAVA百科 solve it? Thanks a lot.
It's extremely difficult to read your code above: it's jumbled. I'd recommend formatting it a bit.
Here's a link to a series that uses the MGTwitterEngine and takes you through using it step by step to create your own twitter application: http://brandontreb.com/creating-a-twitter-client-for-osx-part-1/
I'd recommend going through that to get a better understanding of how the library works.
精彩评论