0
我使用谷歌數據API樣本觸摸應用程序,它可在code.google ....與友情的Twitter OAuth的問題/創建API
我有一個問題,任何一個可以幫助。
請告訴我,如果我做錯了什麼事情。
已經進入的用戶必須關注某人XYZ(爲了安全起見,只需使用 XYZ)。
我使用的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連接[4265:20B] API響應:
<?xml
version="1.0" encoding="UTF-8"?>
<hash>
<request>/1/friendships/create/XYZ.xml</request>
<error>Invalid/used nonce</error>
</hash>