当我使用ASIHTTPRequest对服务器URI进行"POST"时,只需回复"null"。
URI:"http://www.solok.com:8080/solok_interface/api/web/"参数:关键字为"content"的NSDictionary。
我尝试使用ASIHTTPRequest而不是ASIFormDataRequest,但没有"setPostValue"方法。
任何帮助,谢谢!
NSURL * url = [NSURL URLWithString:@"http://localhost:8080/solok_interface/api/web/"];
ASIFormDataRequest *req = [ASIFormDataRequest requestWithURL:url];
[req setRequestMethod:@"POST"];
[req setPostValue:cipherString forKey:@"content"];
[req start];
NSError *error1 = [req error];
if (!error1) {
NSString *reponse = [req responseString];
NSLog(@"Response string is %@",reponse);
}
[req setDelegate:self];
[req setCompletionBlock:^{
NSLog(@"complete");
NSString *responseString = [req responseString];
NSLog(@"the string is %@",responseString);
NSLog(@"The data is %@ %d",[req responseStatusMessage],[req responseStatusCode]);
}];
[req setFailedBlock:^{
NSLog(@"@fail");
}];
我不再使用ASIHTTPRequest,ASI团队已经停止支持它。AFNetworking是IOS开发者的正确选择。