-
Notifications
You must be signed in to change notification settings - Fork 421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
iOS 17 test fixes #3642
iOS 17 test fixes #3642
Conversation
@@ -77,6 +77,12 @@ - (void)testNilURL { | |||
NSString *contentString = @"This is my content"; | |||
NSData *contentData = [contentString dataUsingEncoding:NSUTF8StringEncoding]; | |||
NSURL *url = [[NSURL alloc] initWithString:@"bad string -- will create nil URL"]; | |||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 170000 | |||
if (@available(iOS 17.0, *)) { | |||
url = [[NSURL alloc] initWithString:@"bad string -- will create nil URL" encodingInvalidCharacters:NO]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need the iOS version check now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like they changed the behavior of the API for invalid URLs, from release notes:
Fixed: For apps linked on or after iOS 17 and aligned OS versions, URL parsing has updated from the obsolete RFC 1738/1808 parsing to the same RFC 3986 parsing as URLComponents. This unifies the parsing behaviors of the URL and URLComponents APIs. Now, URL automatically percent- or IDNA-encodes invalid characters to help create a valid URL.
To check if a urlString is strictly valid according to the RFC, use the new URL(string: urlString, encodingInvalidCharacters: false) initializer. This init leaves all characters as they are and will return nil if urlString is explicitly invalid. (93368104)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
May be a little comment in the code so we don't forget why we added the check.
No description provided.