Search code examples
objective-cmgtwitterengine

MGTwitterEngine send retweet is not working


I'm using MGTwitterEngine. I've found this post where shows a modification to the current version of MGTwitterEngine.

I've applied this modification and when I'm executing the method returns this:

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

But nothing happens in the timeline of the Twitter account.

The method added to TwitterEngine is:

- (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];
}

Anyone knows what I'm doing wrong?

Thanks.


Solution

  • Finally I've solved the problem using NSString parameter as 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];
    }