Twitter oauth problem with frindship/create in api

放肆的年华 提交于 2020-01-06 06:49:08

问题


I am using Google Data API sample touch application, which is available at code.google....

I am having a problem can any one help.

Please tell me if I am doing some thing wrong.

The user who has loged in has to follow some person XYZ (just using XYZ for security purpose).

I am using the URL

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

In the response I get

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

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

回答1:


This error can happen if your time and the server time are more than 5 mins different, check that your server / pc has the same time as the server.



来源:https://stackoverflow.com/questions/3022001/twitter-oauth-problem-with-frindship-create-in-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!