Initializer

init(string:)

Initializes an NSURL object with a provided URL string.

Declaration

convenience init?(string URLString: String)

Parameters

URLString

The URL string with which to initialize the NSURL object. This URL string must conform to URL format as described in RFC 2396, and must not be nil. This method parses URLString according to RFCs 1738 and 1808.

Return Value

An NSURL object initialized with URLString. If the URL string was malformed, returns nil.

Discussion

This method expects URLString to contain only characters that are allowed in a properly formed URL. All other characters must be properly percent escaped. Any percent-escaped characters are interpreted using UTF-8 encoding.

See Also

Related Symbols

URLWithString:

Creates and returns an NSURL object initialized with a provided URL string.