Skip to content
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

Merged
merged 4 commits into from
Sep 25, 2023
Merged

iOS 17 test fixes #3642

merged 4 commits into from
Sep 25, 2023

Conversation

bbirman
Copy link
Member

@bbirman bbirman commented Sep 17, 2023

No description provided.

@@ -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];
Copy link
Contributor

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?

Copy link
Member Author

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)

Copy link
Contributor

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.

@bbirman bbirman merged commit ac6030d into forcedotcom:dev Sep 25, 2023
1 check passed
@bbirman bbirman deleted the ios17 branch September 25, 2023 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants