Objective c 将数据发布到Webservice URL

Objective c 将数据发布到Webservice URL,objective-c,post,nsurlrequest,Objective C,Post,Nsurlrequest,我在向webservice发布数据时遇到了代码问题 谁能告诉我哪里出了问题 我需要将三个字段(doctorId字符串、patientId.STRING、date字符串)发布到此地址: 如何使之正确 NSString *post = [NSString stringWithFormat:@"&id_doktor=%@&id_pacijent=%@&datum=%@",@"iddoktora",@"idpacijenta",@"ovojedatum"]; NSData* p

我在向webservice发布数据时遇到了代码问题

谁能告诉我哪里出了问题

我需要将三个字段(doctorId字符串、patientId.STRING、date字符串)发布到此地址:

如何使之正确

NSString *post = [NSString stringWithFormat:@"&id_doktor=%@&id_pacijent=%@&datum=%@",@"iddoktora",@"idpacijenta",@"ovojedatum"];
NSData* postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];

//You need to send the actual length of your data. Calculate the length of the post string.
NSString *postLength = [NSString stringWithFormat:@”%d”,[postData length]];

//Create URLRequest object and initialize it.
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];

//Set the Url for which your going to send the data to that request
[request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://www.walter-dev.com/doctor/public/setTermin"]]];

//set HTTP method (POST)
[request setHTTPMethod:@"POST"];

//Set header field with lenght of the post data
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];

//I dont understand this line of code
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Current-Type"];


//Set httpbody of the urlrequest with string "post"
[request setHTTPBody:postData];

//Initialize object with urlRequest
NSURLConnection *conn = [[NSURLConnection alloc]initWithRequest:request delegate:self];

if(conn)
{
    NSLog(@"Konekcija prema serveru je uspjela");
}
else
{
    NSLog(@"NIJE USPJELA ");
}

这不是一个问题。请添加有关您遇到的问题和正在搜索的内容的信息。此外,请不要将标签名称添加到您的帖子标题中。