我正在使用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>
答案 0 :(得分:0)
如果您的时间和服务器时间超过5分钟,则会发生此错误,请检查您的服务器/ PC与服务器的时间是否相同。