I could not really find this in the documentation.
I’m writing some unit tests and one of the tests that is supposed to fail is [NSURL URLWithString: @"cow"]. Because cow is not a valid URL.
However, it is happily parsed by NSURL with no errors at all. It does not return nil and it does not throw an exception. Calling [url absoluteString] on it turns it back into @"cow".
What is going on here? Is NSURL really supposed to allow this?
NSURL allows relative URLs, which would include “cow”.
The general form of a URI given in RFC 2396 allows relative references:
Unless I’m misreading horribly, this means any sequence of valid characters can form a valid relative URL.