NSURLRequest中不支持的URL

编程入门 行业动态 更新时间:2024-10-12 18:18:57
本文介绍了NSURLRequest中不支持的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如果我从终端运行此请求,我可以正常看到JSON请求:

If I run this request from my terminal I can see the JSON requests as normally:

curl -XGET 192.168.0.6:8888/scripts/data/backend2/index.php/name/_all

我的NSURlRequest代码是这样:

My code for the NSURlRequest is this:

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?我无法访问服务器代码 - 我知道如果我调用该URL,它只是设置回报我需要的东西吗?

How can I make the call to that URL? I cannot access the server code - I know it is just setup to return me what I need, if I call that URL?

推荐答案

尝试在您的网址中加入适当的网址方案,例如

Try to include appropriate url scheme to your url, e.g.

[NSURL URLWithString:@http:// www ...

更多推荐

NSURLRequest中不支持的URL

本文发布于:2023-10-24 21:02:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1524994.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中不   NSURLRequest   URL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!