一种方法
ASIHTTPRequest *request = [ASIHTTPRequestrequestWithURL:[NSURLURLWithString:bodyString]]; [request setDelegate:self]; request.timeOutSeconds = 20; [request setRequestMethod:@"POST"]; [request addRequestHeader:@"Content-Type"value:@"application/xml;charset=UTF-8;"]; [request setValidatesSecureCertificate:NO];//请求https的时候,就要设置这个属性 [request startAsynchronous];
二种方法
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:bodyString]]; [request setDelegate:self]; request.timeOutSeconds = 20; [request setValidatesSecureCertificate:NO];//请求https的时候,就要设置这个属性
[request setRequestMethod:@"POST"]; [request addRequestHeader:@"Content-Type" value:@"application/xml;charset=UTF-8"]; request.defaultResponseEncoding = NSUTF8StringEncoding;