ghostrider ghostrider - 1 year ago 155
JSON Question

Unsupported URL in NSURLRequest

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

curl -XGET

My code for the NSURlRequest is this:

NSURLRequest *request = [NSURLRequest requestWithURL:
[NSURL URLWithString:@""]];

[[NSURLConnection alloc] initWithRequest:request delegate:self];

And I am getting this error:

2013-11-29 22:31:08.164 Ski Greece[607:a0b] Connection failed: Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo=0xcd042d0 {NSErrorFailingURLStringKey=, NSErrorFailingURLKey=, NSLocalizedDescription=unsupported URL, NSUnderlyingError=0xdbdcc70 "unsupported 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?

Answer Source

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

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download