我有如下卷曲请求
curl -H '授权:OAuth oauth_signature_method="PLAINTEXT",oauth_consumer_key="de4422f-f3ff-4929-bb65-eadc6f5218e2",oauth_token="85ab49a-9081-4641-812c-09d3130e3a8",oauth_signature="0723ba36-8-8 9337-7e81004655c%26e385879b-0b57-481b-a8fc-8eb1426fc72"' https://external.ningapis.com/xn/rest/ippinn/1.0/User/?author=0n1s8aln92xhx&fields=iconUrl,email,url,fullName,birthdate ,性别'
我想使用 NSURLRequest 创建相同的请求我尝试过并在论坛上搜索得到很多解决方案,但没有成功
我做了以下代码
NSURL *url = [NSURL URLWithString:@"https://external.ningapis.com/xn/rest/ippinn/1.0/User/?author=0n1s8aln92xhr&fields=iconUrl,email,url,fullName,birthdate,gender"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
[request setHTTPMethod:@"POST"];
NSString *authorization = @"OAuth ";
authorization = [authorization stringByAppendingFormat:@"oauth_signature_method=%@",@"PLAINTEXT"];
authorization = [authorization stringByAppendingFormat:@"&oauth_consumer_key=%@",@"de4422f-f3ff-4929-bb65-eadc6f5218e2"];
authorization = [authorization stringByAppendingFormat:@"&oauth_token=%@",@"85ab49a-9081-4641-812c-09d3130e3a8"];
authorization = [authorization stringByAppendingFormat:@"&oauth_signature=%@",@"0723ba36-8d19-4fab-9337-7e81004655c%26e385879b-0b57-481b-a8fc-8eb1426fc72"];
NSLog(@"authorization =>%@",authorization);
[request setValue: authorization forHTTPHeaderField: @"Authorization"];
self.connection = [NSURLConnection connectionWithRequest:request delegate:self];
if (_connection) {
self.receivedData = [[NSMutableData data] retain];
}
请建议我哪里出错了