1

在我的应用程序中使用 ShareKit 来集成 FB 和 Twitter 状态更新。FB 服务运行良好。但是,在我的 Twitter 服务中,我遇到了这个错误:

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

这是我的代码:

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

这在我第 1-3 次尝试时发生,但是当我尝试再次运行/调试应用程序时,它将成功更新。

所以,我不知道真正的问题是什么。消费者和密钥都是正确的。

任何想法?太奇怪了..谷歌搜索,我没有找到具体的答案,但我想这与 oAuth 有关。

4

1 回答 1

0

评论无法格式化,所以我写了一个答案。解决方案是将 twitter.com 更改为 api.twitter.com 并且对于需要更改更新 url 的更新:

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

在这里修复:https ://github.com/ideashower/ShareKit/issues/229#issuecomment-1221634

于 2011-05-24T09:13:46.073 回答