【问题标题】:Twitter oauth problem with frindship/create in apiTwitter oauth 问题与 api 中的 frindship/create
【发布时间】:2011-03-02 14:36:53
【问题描述】:

我正在使用 Google Data API 示例触摸应用程序,该应用程序可在 code.google.... 获得。

我有问题,谁能帮忙。

如果我做错了什么,请告诉我。

已登录的用户必须关注某个人 XYZ(只需使用 XYZ 出于安全目的)。

我正在使用网址

urlStr = @"http://api.twitter.com/1/friendships/create/XYZ.xml";

NSURL *url = [NSURL URLWithString:urlStr];

       NSMutableURLRequest *request = [NSMutableURLRequest
requestWithURL:url];


//made post as requested in twitter API

       [request setHTTPMethod:@"POST"];

       ConnectAppDelegate *appDelegate = (ConnectAppDelegate *)
[[UIApplication sharedApplication] delegate];

       [mAouth authorizeRequest:request];
NSError *error = nil;
       NSURLResponse *response = nil;
       NSData *data = [NSURLConnection sendSynchronousRequest:request
returningResponse:&response error:&error];
       if (data) {
               // API fetch succeeded
               NSString *str = [[[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding] autorelease];
               NSLog(@"API response: %@", str);
       } else {
               // fetch failed
               NSLog(@"API fetch error: %@", error);
       }

在我得到的回复中

http://api.twitter.com/1/friendships/create/XYZ.xml 2010-06-11 16:04:39.437 连接 [4265:20b] API 响应:

<?xml
version="1.0" encoding="UTF-8"?>
<hash>
 <request>/1/friendships/create/XYZ.xml</request>
 <error>Invalid / used nonce</error>
</hash>

【问题讨论】:

    标签: iphone objective-c oauth twitter google-data-api


    【解决方案1】:

    如果您的时间和服务器时间相差超过 5 分钟,就会出现此错误,请检查您的服务器/电脑与服务器的时间是否相同。

    【讨论】:

      猜你喜欢
      • 2018-12-10
      • 2011-03-06
      • 1970-01-01
      • 1970-01-01
      • 2011-07-16
      • 2011-02-22
      • 2011-06-08
      相关资源
      最近更新 更多