开发者

Incorrect signature error

开发者 https://www.devze.com 2023-03-07 00:39 出处:网络
Using ShareKit in my app to integrate FB & Twitter status updates. The FB service is working fine. However, in my Twitter service I encountered this error:

Using ShareKit in my app to integrate FB & Twitter status updates. The FB service is working fine. However, in my Twitter service I encountered this error:

Twitter Send Status Error: {"request":"\/1\/statuses\/update.json","error":"Incorrect signature"}

Here's my code:

if (m_prodDetails != nil && [m_prodDetails count] > 0) {
    NSString *strTemp = [[NSString alloc] initWithString:API_HOSTSERV_PROD_URL];
    // http://ipasarmalam.com/p/proddetails.aspx?id=55344
    NSString *urlString = [strTemp stringByAppendingString: [m_prodDetails objectAtIndex:0]];

    NSURL *url = [NSURL URLWithString:urlString];
    if (url != nil) {
        NSLog(@"url is correct: %@", url);            
    }
    NSLog(@"urlString: %@", urlString);
    NSLog(@"url: %@", url);

    SHKItem *item = [SHKItem URL:url title:m_prodName.text];
    SHKActionSheet *actionSheet = [SHKActionSheet actionSheetForItem:item];
    [actionSheet showFromTabBar:self.tabBarController.tabBar];  

    [strTemp release];
}

This happen to me on 1-3rd try but when I try to run/debug agai开发者_如何学JAVAn the app, it will update successfully.

So, I don't know what's really the problem. The consumer & secret keys are all correct.

Any idea? It's so strange..googling it around, I didn't find a specific answer but I guess it's something to do with oAuth.


The comment cannot be formated, so I write an answer. The solution is to change twitter.com to api.twitter.com and also for updates you need to change the update url:

OAMutableURLRequest *oRequest = [[OAMutableURLRequest alloc] initWithURL:[NSURL URLWithString:@"api.twitter.com/1/statuses/update.json"] consumer:consumer token:accessToken realm:nil signatureProvider:nil];

Fixed here: https://github.com/ideashower/ShareKit/issues/229#issuecomment-1221634

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号