NSURL baseURL returns nil. Any other way to get the actual base URL
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]);
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:
This base URL
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?
Published on 09 Apr 2013 at 07:20AM