如果我从终端运行此请求,我可以看到
JSON请求正常:
curl -XGET 192.168.0.6:8888/scripts/data/backend2/index.PHP/name/_all
我的NSURlRequest代码是:
NSURLRequest *request = [NSURLRequest requestWithURL: [NSURL URLWithString:@"192.168.0.6:8888/scripts/data/backend2/index.PHP/name/_all"]]; [[NSURLConnection alloc] initWithRequest:request delegate:self];
我收到这个错误:
didFailWithError 2013-11-29 22:31:08.164 Ski Greece[607:a0b] Connection Failed: Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo=0xcd042d0 {NSErrorFailingURLStringKey=192.168.0.6:8888/scripts/data/backend2/index.PHP/name/_all,NSErrorFailingURLKey=192.168.0.6:8888/scripts/data/backend2/index.PHP/name/_all,NSLocalizedDescription=unsupported URL,NSUnderlyingError=0xdbdcc70 "unsupported URL"}
解决方法
尝试在您的网址中包含适当的URL方案,例如
[NSURL URLWithString:@“http:// www …