Contents

componentsWithString:encodingInvalidCharacters:

Returns a URL components instance from the provided string, optionally IDNA- and percent-encoding any invalid characters.

Declaration

+ (instancetype) componentsWithString:(NSString *) URLString encodingInvalidCharacters:(BOOL) encodingInvalidCharacters;

Parameters

  • URLString:

    The URL string to parse.

  • encodingInvalidCharacters:

    A Boolean value that indicates whether the initializer attempts to encode any invalid characters in URLString.

Return Value

A URL components instance from the provided string, optionally with invalid characters percent-encoded.

Discussion

If encodingInvalidCharacters is true, this initializer tries to encode the string to create a valid URL. If the URL string is still invalid after encoding, the method returns nil.

See Also

Creating URL components