I\'m trying to check if a given URL is valid and i\'m doing it like this:
- (BOOL)urlIsValid:(NSString *)address {
NSURL *testURL = [NSURL URLWithString:
I think you may be confused regarding the definition of "malformed". Anything conforming to RFC 2396 is considered valid; in practice, it seems NSURL will also accept [ and ] despite their not being allowed by the RFC.
That means pretty much any string of printable ASCII characters besides space, ", % when not followed by two hex digits, <, >, \, ^, `, {, |, and } will be considered "valid", although it may not be absolute or generally useful. Strings containing multiple # may also be rejected.