【问题标题】:Has anyone used Twitter + OAuth library and did a retweet?有没有人使用 Twitter + OAuth 库并转发了推文?
【发布时间】:2011-11-02 15:12:59
【问题描述】:

我正在尝试管理这个库并想转发消息。

具体方法是这样的:

- (NSString *)sendRetweet: **(unsigned long)updateID**
{

if (updateID == 0){
return nil;
}

NSString *path = [NSString stringWithFormat:@"statuses/retweet/%u.%@", updateID, API_FORMAT];


return [self _sendRequestWithMethod:HTTP_POST_METHOD pathath 
queryParameters:nil body:nil 
requestType:MGTwitterUpdateSendRequest
responseType:MGTwitterStatus];


}

这个方法在库本身没有实现,我已经添加了。

我不知道 updateId 是什么。我尝试使用 json 中的 id,但我不知道正确的 id 是什么..:

查看字典:{

contributors = "";
coordinates = "";
"created_at" = "Wed Aug 24 07:41:50 +0000 2011";
favorited = false;
geo = "";
id = **106269972766011392**;
"in_reply_to_screen_name" = "";
"in_reply_to_status_id" = "";
"in_reply_to_user_id" = "";
place = "";
"possibly_sensitive" = false;
"retweet_count" = 0;
retweeted = false;
source = "<a href=\"http://www.tweetdeck.com\" rel=\"nofollow\">TweetDeck</a>";
"source_api_request_type" = 1;
text = "Buenos d\U00edas familia! Vuelve Tom Waits... http://t.co/3fbLqbb #musica";
truncated = 0;
user =     {
    "contributors_enabled" = false;
    "created_at" = "Tue Jan 13 14:25:32 +0000 2009";
    "default_profile" = false;
    "default_profile_image" = false;
    description = "Twitter Oficial de Vodafone Espa\U00f1a para compartir noticias y novedades ";
    "favourites_count" = 4;
    "follow_request_sent" = false;
    "followers_count" = 26260;
    following = 1;
    "friends_count" = 11928;
    "geo_enabled" = false;
    id = 18939115;
    "is_translator" = false;
    lang = en;
    "listed_count" = 1429;
    location = "from Madrid";
    name = "vodafone_espa\U00f1a";
    notifications = false;
    "profile_background_color" = BADFCD;
    "profile_background_image_url" = "http://a1.twimg.com/profile_background_images/303932010/twitter_ro3.jpg";
    "profile_background_image_url_https" = "https://si0.twimg.com/profile_background_images/303932010/twitter_ro3.jpg";
    "profile_background_tile" = false;
    "profile_image_url" = "http://a1.twimg.com/profile_images/1299308789/Twitter-800x800pxNEW_normal.jpg";
    "profile_image_url_https" = "https://si0.twimg.com/profile_images/1299308789/Twitter-800x800pxNEW_normal.jpg";
    "profile_link_color" = FF0000;
    "profile_sidebar_border_color" = F2E195;
    "profile_sidebar_fill_color" = ebebeb;
    "profile_text_color" = 0C3E53;
    "profile_use_background_image" = true;
    protected = 0;
    "screen_name" = "vodafone_es";
    "show_all_inline_media" = false;
    "statuses_count" = 8109;
    "time_zone" = Madrid;
    url = "http://www.vodafone.es";
    "utc_offset" = 3600;
    verified = false;
};

}

看看有没有人用过这个功能,我可以帮忙!

非常感谢您!

【问题讨论】:

    标签: objective-c xcode twitter mgtwitterengine


    【解决方案1】:

    尝试将以下代码中的 %u 更改为 %@ 并将更新 ID 作为 NSString 传递

    NSString *path = [NSString stringWithFormat:@"statuses/retweet/%u.%@", updateID, API_FORMAT];

    twitter 中的更新 ID 早已通过 unsigned int 最大值 :-)。

    您还必须更新方法签名以传递字符串而不是无符号整数。

    【讨论】:

    • 更好地使用unsigned long long 值,他们与我合作过
    猜你喜欢
    • 2011-12-14
    • 1970-01-01
    • 2011-11-06
    • 2012-10-27
    • 2012-04-01
    • 2012-12-23
    • 2011-05-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多