如何使用NSURLRequest在Http请求中发送json数据
我是Objective-c的新手,从最近开始,我就在请求/响应中投入了大量精力。我有一个工作示例,可以调用url(通过http GET)并解析返回的json。 下面的工作示例 - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { [responseData setLength:0]; } - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data { [responseData appendData:data]; } - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error { NSLog([NSString stringWithFormat:@"Connection failed: %@", [error description]]); } - (void)connectionDidFinishLoading:(NSURLConnection *)connection { [connection release]; //do something with the json that comes back ... (the …