Twitter API “retweeted_status” field in “home_timeline” request

落爺英雄遲暮 提交于 2019-12-06 12:47:48

问题


I'm using MGTwitterEngine + OAuth in my iPhone application. All works fine, but when I'm requesting home_timeline of friends_timeline with include_rt option I'm not getting retweeted_status field.

dev.twitter.com/doc/get/statuses/home_timeline Responce should contain "retweeted_status" structure for retweets (as you can see in the sample). It describes source tweet that was retweeted.

dev.twitter.com/console If you will use Twitter Console - you will get this structure successfully.

But my app recieves this structure as empty. Like " < retweeted_status>\n< /retweeted_status>". All requests are working great except this.

Have anyone seen this? What's the solution?

PS: I've find this http://www.mail-archive.com/twitter-development-talk@googlegroups.com/msg25383.html and a few similar discussions, but this is madness if it is true. )

Thanks.


回答1:


I've found the answer. It was so simple. SAOAuthTwitterEngine engine uses MGTwitterEngine but allows it to use OAuth. But this engine is using MGTwitterEngine created in 2008, when MGTwitterEngine didn't know about "retweeted_status" because this feature appeared later.

Anyway. All I was need to do - if to add [elementName isEqualToString:@"retweeted_status"] case for

  • (void)parser:(NSXMLParser *)theParser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict

and

  • (void)parser:(NSXMLParser *)theParser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName

methods in MGTwitterStatusesParser.m similarly to [elementName isEqualToString:@"status"] case.



来源:https://stackoverflow.com/questions/4364911/twitter-api-retweeted-status-field-in-home-timeline-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!