Twitter OAuth问题与api/在API中创建 [英] Twitter oauth problem with frindship/create in api

查看:122
本文介绍了Twitter OAuth问题与api/在API中创建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

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

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

我正在使用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);
       }

在回应中我得到

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

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>

推荐答案

如果您的时间和服务器时间相差5分钟以上,则可能会发生此错误,请检查您的服务器/个人计算机与服务器的时间是否相同.

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.

这篇关于Twitter OAuth问题与api/在API中创建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆