我想送POST请求没有身在IOS如何在ios中发送没有正文的json POST请求?
我试过如下
NSString *url = [NSString stringWithFormat:@"Some URL"];
NSURL *URL = [NSURL URLWithString:[NSString stringWithFormat:@"%@",url]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:URL];
[request addValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[request setHTTPMethod: @"POST"];
[NSURLConnection connectionWithRequest:request delegate:self];
我提示以下错误:
Error Domain=NSURLErrorDomain Code=-1004 "Could not connect to the server." UserInfo=0x15d62ed0
NSLocalizedDescription=Could not connect to the server.,
NSUnderlyingError=0x15e522a0 "Could not connect to the server."}
“Some URL “不是一个有效的URL!你有没有尝试向其他程序发布一些内容以确保其正常工作? – folkol 2014-09-20 09:13:26
嘿@Madhu检查我的答案。,,,, – 2014-09-20 09:21:42