【发布时间】:2015-03-13 22:07:11
【问题描述】:
我使用Swifter Framework 来获取使用特定主题标签的推文,但我还需要用户图像和名称。
使用这种方法,我可以获取推文文本,并且可以从 JSON 响应中读取个人资料图片和用户名,但我无法将其放入变量中。
PS:不要介意索引 0...19 它只是测试
let swifter = Swifter(consumerKey: "MyConsumerKey", consumerSecret: "MyConsumerSecret", appOnly: true)
swifter.authorizeAppOnlyWithSuccess({ (accessToken, response) -> Void in
swifter.getSearchTweetsWithQuery("%23realmadrid", geocode: nil, lang: nil, locale: nil, resultType: nil, count: 20, until: nil, sinceID: nil, maxID: nil, includeEntities: true, callback: nil, success: { (statuses, searchMetadata) -> Void in
for index in 0...19 {
if let statusText = statuses?[index]["text"].string {
self.tweetsArray.addObject(statusText)
}
if let statusName = statuses?[index]["screen_name"].string {
println("@%@", statusName)
}
if let statusImage = statuses?[index]["profile_image_url"].string {
println("@%@", statusImage)
}
}
self.tableView.reloadData()
}, failure: { (error) -> Void in
})
}, failure: { (error) -> Void in
println("error")
})
【问题讨论】:
-
嗨@Plasher你得到答案了吗???因为我也面临同样的问题
-
我正在发布答案