Does URL.query(percentEncoded:) calls URL.host(percentEncoded:) under the hood?

I see that there is a known issue about URL.host(percentEncoded:) to raise an EXC_BREAKPOINT crash on iOS 16.

I used Url.query(percentEncoded:) and it triggered a crash on iOS 16 but the exception is shown at Url.host() instead of Url.query(). So, is there a chance that Url.query() calls Url.host() under the hood?

I was able to resolve the crash by replacing Url.query(percentEncoded:) with the older API Url.query, but I don't understand that why would accessing the query would also access the host?

Can you post an snippet that reproduces this crash?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Here is the code snippet: (The crash is triggered on iOS 16)

let urlWithNoQuery = URL(string: "https://www.apple.com/")!
    _ = urlWithNoQuery.query(percentEncoded: true)

I have created a single view app with only these two lines of code. As you can see that I have called URL.query(percentEncoded:), while the app crashes at Url.host(percentEncoded:). Why does accessing the query crashes on accessing the host, when I am not even using Url.host(percentEncoded:). anywhere.

Here is a simple View Controller for reference.

@eskimo I have added the related code snippet. Thank you!

Sorry for not responding. I missed your replies and I’m not sure why [1].

Anyway, I see that you started a thread for this over on Swift Forums, so I’m going to defer to that.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Normally this is because folks reply in the comments — see tip 5 in Quinn’s Top Ten DevForums Tips — but that’s not the case here.

Does URL.query(percentEncoded:) calls URL.host(percentEncoded:) under the hood?
 
 
Q