签名错误错误

发布于 2024-11-08 18:34:28 字数 1129 浏览 0 评论 0原文

在我的应用程序中使用 ShareKit 来集成 FB 和推特状态更新。 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 有关。

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 again 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

翻身的咸鱼 2024-11-15 18:34:28

评论无法格式化,所以我写一个答案。
解决方案是将 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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文