Twitter OAuth问题与api/在API中创建 [英] Twitter oauth problem with frindship/create in 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屋!