【问题标题】:MGTwitterEngine send retweet is not workingMGTwitterEngine 发送转推不起作用
【发布时间】:2012-04-16 19:36:13
【问题描述】:

我正在使用 MGTwitterEngine。我发现 this 帖子显示了对当前版本的 MGTwitterEngine 的修改。

我已经应用了这个修改,当我执行该方法时返回这个:

2012-04-10 01:04:17.908 Otsuka On[27519:707] INFO -> retweet response: 07695198-2526-4FF4-BC46-8D39F7719836

但 Twitter 帐户的时间线没有任何反应。

添加到 TwitterEngine 的方法是:

- (NSString *)sendRetweet:(unsigned long)updateID
{
    if (updateID == 0){
        return nil;
    }
    NSString *path = [NSString stringWithFormat:@"statuses/retweet/%u.%@", updateID, API_FORMAT];

    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0];
    [params setObject:[NSString stringWithFormat:@"%u", updateID] forKey:@"id"];
    NSString *body = [self _queryStringWithBase:nil parameters:params prefixed:NO];


    return [self _sendRequestWithMethod:HTTP_POST_METHOD path:path 

                        queryParameters:params body:body 
                            requestType:MGTwitterUpdateSendRequest
                           responseType:MGTwitterStatus];
}

谁知道我做错了什么?

谢谢。

【问题讨论】:

    标签: objective-c mgtwitterengine


    【解决方案1】:

    我使用以下方法,它对我有用:

    - (NSString *)sendRetweet:(MGTwitterEngineID)tweetID {    
        NSString *path = [NSString stringWithFormat:@"statuses/retweet/%llu.%@", tweetID,     API_FORMAT];
    
        return [self _sendRequestWithMethod:HTTP_POST_METHOD path:path 
                            queryParameters:nil body:nil 
                                requestType:MGTwitterRetweetSendRequest
                               responseType:MGTwitterStatus];
    

    }

    更新:是的,尝试使用这个分支:github.com/mattgemmell/MGTwitterEngine

    【讨论】:

    • 嗨! (MGTwitterEngineID)tweetID 哪些数据填充了这个参数?我正在使用要转发的推文的 id 字段。谢谢。
    • 您使用的是哪个版本的 MGTwitterEngine?在我的版本中,MGTwitterRetweetSendRequest 枚举不存在。
    【解决方案2】:

    最后我用 NSString 参数作为 updateID 解决了这个问题:

    - (NSString *)sendRetweet:(NSString *)updateID
    {
    
        NSString *path = [NSString stringWithFormat:@"statuses/retweet/%@.%@", updateID, API_FORMAT];
    
        NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0];
        [params setObject:[NSString stringWithFormat:@"%@", updateID] forKey:@"id"];
        NSString *body = [self _queryStringWithBase:nil parameters:params prefixed:NO];
    
    
        return [self _sendRequestWithMethod:HTTP_POST_METHOD path:path 
    
                            queryParameters:params body:body 
                                requestType:MGTwitterUpdateSendRequest
                               responseType:MGTwitterStatus];
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-09
      • 2011-10-29
      • 1970-01-01
      • 2013-08-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-08
      相关资源
      最近更新 更多