【问题标题】:Twitter Integration in iPhone AppiPhone 应用程序中的 Twitter 集成
【发布时间】:2011-11-03 09:21:50
【问题描述】:

我想将 Twitter 集成到我的 iPhone 应用程序中,以获取特定 Twitter 帐户的一些推文。请建议我这样做的最佳主意?

注意:

1) 我只想显示来自特定帐户的推文。任何短 方法将有助于完整而不是完整的 twitter 集成

2) 目前我正在使用 RSS 来获取推文,但在某处我听说过 RSS 推特提要非常不可靠,它们将停止 即将支持 RSS。

问候!!

【问题讨论】:

    标签: iphone objective-c ios api twitter


    【解决方案1】:

    如果您不想使用完整的实现,只需查询特定用户的状态 例如,要使用 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
    

    【讨论】:

      【解决方案2】:

      https://github.com/jaanus/PlainOAuth/tree/27a8631a5e32c36ea40d532c8343fafe7cc5e95c 并下载源项目..

      此链接为您提供最后五条推文..

      【讨论】:

        【解决方案3】:

        得到了答案。 - 我将 MGTwitterEngine 添加到我的项目中。

        这里是代码:[MyViewController's -(void)viewDidLoad]-

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

        如果你们需要更多说明,请随时提问。我会尽力帮助你。

        问候!!

        【讨论】:

          猜你喜欢
          • 2011-09-03
          • 2011-09-14
          • 2012-02-04
          • 2012-01-14
          • 2011-03-09
          • 1970-01-01
          • 2012-02-04
          • 1970-01-01
          相关资源
          最近更新 更多