Unsupported URL in NSURLRequest

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

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


In my case, I visit a service running on my own mac, so my url is 127.0.0.1:8080/list

After I add a http:// scheme. It works!

Now it is http://127.0.0.1:8080/list instead of 127.0.0.1:8080/list


I too struggled for the same error, even though the url path was correct but there was a space in it, before http, like below:

NSString *path = @" http://www.mylink/";
NSURL *url = [NSURL URLWithString:path];

so I was getting url as nil and so it was giving "unsupported URL". then by removing the space worked for me.


In my case I fixed it with this :

strURL = [strURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

strURL contains the string with the URL.