I think I don't understand the concept of "baseURL". This:

NSLog(@"BASE URL: %@ %@", [NSURL URLWithString:@"http://www.google.es"], [[NSURL URLWithString:@"http://www.google.es"] baseURL]);

Prints this:

BASE URL: http://www.google.es (null)

And of course, in the Apple docs I read this:

Return Value The base URL of the receiver. If the receiver is an absolute URL, returns nil.

I'd like to get from this example URL:

https://www.google.es/search?q=uiviewcontroller&aq=f&oq=uiviewcontroller&sourceid=chrome&ie=UTF-8

This base URL

https://www.google.es

My question is simple. Is there any cleaner way of getting the actual base URL without concatenating the scheme and the hostname? I mean, what's the purpose of base URL then?

Edit
Report