JSON发布请求

时间:2011-04-27 09:56:09

标签: iphone objective-c json linkedin

我正在使用LinkedIn API开发iPhone应用程序。我正在发送JSON请求。但我收到400错误。这是我发送的请求

  NSString *jsonRequest = [NSString stringWithFormat:@"{\"contentType\":\"linkedin-html\",\"body\":\"hii\"}"]; 

NSData *postData = [NSData dataWithBytes:[jsonRequest UTF8String] length:[jsonRequest length]]; 

 [self setHTTPBody:postData];

[self setValue:[NSString stringWithFormat:@"%d", [postData length]] forHTTPHeaderField:@"Content-Length"];

  [self setValue:@" application/json" forHTTPHeaderField:@"Content-Type"];

错误是什么?

0 个答案:

没有答案