簡體   English   中英

iPhone應用程序中的Twitter集成

[英]Twitter Integration in iPhone App

我想將Twitter集成到我的iPhone App中,以獲取特定Twitter帳戶的一些推文。 請建議我這樣做的最好主意?

注意:

1)我只想顯示來自特定帳戶的推文。 任何簡短的方法都將有助於完整而非完整的Twitter集成

2)目前,我正在使用RSS來獲取推文,但我聽說某處RSS Twitter提要非常不可靠,並且它們將很快停止對RSS的支持。

問候 !!

如果您不想使用完整的實現,則只需查詢特定用戶的狀態即可。例如,使用ASIHTTPRequest從charliesheen獲取最后20條推文

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
}

如果不想使用xml,只需將其更改為json

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

https://github.com/jaanus/PlainOAuth/tree/27a8631a5e32c36ea40d532c8343fafe7cc5e95c並下載源項目。

該鏈接為您提供最后五條推文。

得到了答案。 -我在項目中添加了MGTwitterEngine。

下面是代碼: [MyViewController的-(void)viewDidLoad] -

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

如果你們需要更多說明,請隨時提出。 我會盡力為您提供幫助。

問候!!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM