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

**URL:** <https://forums.swift.org/t/does-url-query-percentencoded-calls-url-host-percentencoded-under-the-hood/70452>\
**Category:** Using Swift\
**Tags:** swift\
**Created:** [March 5, 2024, 10:58pm UTC](https://forums.swift.org/t/does-url-query-percentencoded-calls-url-host-percentencoded-under-the-hood/70452 "2024-03-05T22:58:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![efatima](https://avatars.discourse-cdn.com/v4/letter/e/41988e/32.png) [@efatima](https://forums.swift.org/u/efatima)\
**Post date:** [March 5, 2024, 10:58pm UTC](https://forums.swift.org/t/does-url-query-percentencoded-calls-url-host-percentencoded-under-the-hood/70452/1 "2024-03-05T22:58:51Z")

</div>

I see that there is a [known issue](https://forums.developer.apple.com/forums/thread/722451) 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?

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

```swift
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.

 ![Url.host](https://global.discourse-cdn.com/swift/original/3X/7/6/76cbd7437eed9eb13dd61ddf15f0d97be6d8daf9.png)

Here is a simple View Controller for reference.

 ![controller](https://global.discourse-cdn.com/swift/original/3X/0/3/0322c60eb37793a4f5f566532a007bcf2b059507.png)
