支持 oAuth 和 streaming api 的 objective c Twitter library

2011-02-05 05:42:03 +08:00
 timshi
5436 次点击
所在节点    iDev
6 条回复
timshi
2011-02-05 05:56:04 +08:00
因为发现 twitter 推荐的 MG Twitter Engine 不支持 oAuth 和 streaming api,并且set up过程很复杂(它试图支持各种xml 和 json 的 parser)。所以动手在它的基础上加了这两个功能,并且简化了 setup 的步骤, 然后写了一个小的 demo project。请问有人计划做iOS上的 twitter integration么,你觉得这样的project有开源的价值么?
Livid
2011-02-05 06:56:30 +08:00
我觉得直接用 ASIHTTPRequest 做会让事情简单很多,尤其是在 ASIHTTPRequest 支持 blocks 之后。
timshi
2011-02-05 07:18:41 +08:00
ASIHttpRequest 是 CFNetwork 的 wrapper 吧? 如果用它可能可以简化这个library的实现。不过我所提到的library是更高一层的abstraction, 用户直接调用象 updateStatus, follow, unfollow 这样的method。 不需要直接接触 http connection 一层的东西, 那些都由library 处理。另外oAuth方面也是一样,用户只需要调用 requestRequestToken, requestAccessToken,和他们的delegate,而不需要去接触http级的东西。
Livid
2011-02-05 07:20:56 +08:00
@timshi 可以做一个 Singleton 实现的 simple Twitter data client,任何时候需要用到 Twitter 的时候,就这样子:

TwitterUser * user = [[TwitterManager sharedManager] currentUser];

[[TwitterManager sharedManager] updateStatusWithString:@"Hello world"];
timshi
2011-02-05 10:15:40 +08:00
@livid 我正是这么想的。
timshi
2011-02-05 11:46:26 +08:00
git hub

https://github.com/TimShi/TSTwitterEngine

check out project 以后:

1. 在 TwitterEngine.h 里填上你的 consumer key, consumer secret
2. 在 TwitterCommonLibraryAppDelegate.m 里把 tracking keyword 改成你想要的tracking keyword. 现在是设置成 "github"

That's it, build and run the project。

你会先被提示去登录 twitter, 然后 twitter 上所有带你所设定的 keyword 的 tweets 都会实时出现在 tableview 上。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/8036

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX