开发者

Twitter Integration in iPhone App

I want to integrate Twitter in my iPhone App for getting some tweets of a particular twitter account. Please suggest me开发者_运维知识库 the best idea to do that ?

NOTE:

1) I just want to show the tweets from a particular account. Any short method will be help full rather than full twitter integration

2) For now I am using RSS to get the tweets but somewhere I've heard that RSS twitter feeds are very unreliable and they are going to stop support for RSS soon.

Regards !!


If you don't want to use a full implementation, you just need to perform a query to the statuses of the specific user For example, to get the last 20 tweet from charliesheen with ASIHTTPRequest

NSURL *url = [NSURL URLWithString:@"http://twitter.com/statuses/user_timeline/charliesheen.xml"];
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request setDelegate:self];
[request startAsynchronous];

- (void)requestFinished:(ASIHTTPRequest *)request {
// this is called if the request is successful
}

- (void)requestFailed:(ASIHTTPRequest *)request {
// this is called if the request fails
}

If don't want to use xml, just change it to json

http://twitter.com/statuses/user_timeline/charliesheen.json


https://github.com/jaanus/PlainOAuth/tree/27a8631a5e32c36ea40d532c8343fafe7cc5e95c And download the source project..

This links provide you last five tweets..


Got the answer. - I added MGTwitterEngine into my project.

Here is the code :[MyViewController's -(void)viewDidLoad]-

MGTwitterEngine *twitterEngine = [[MGTwitterEngine alloc] initWithDelegate:self];
[twitterEngine getUserTimelineFor:username sinceID:0 startingAtPage:0 count:10];

If you guys need some more clarification feel free to ask. I'll try to help you out as much as I can.

Regards!!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜