[GH-ISSUE #47] Assertion Failure when using file URLs #36

Closed
opened 2026-03-03 19:11:10 +03:00 by kerem · 8 comments
Owner

Originally created by @kenjitayama on GitHub (Dec 23, 2020).
Original GitHub issue: https://github.com/ProxymanApp/atlantis/issues/47

Originally assigned to: @NghiaTranUIT on GitHub.

I get this assertion failure when using file URLs.

Fatal error: Only support HTTPURLResponse: file Atlantis/Packages.swift, line 209

It can be reproduced with this code in an iOS app.

if let url = Bundle.main.url(forResource: "Info", withExtension: "plist") {
  let task = URLSession.shared.downloadTask(with: url)
  task.resume()
}

In our app, many resources are retrieved from a web server, while some are bundled in the app.
For a specific kind of resource, we want to use the same implementation for web and bundled file, which uses URLSessionDownloadTask.
It would be helpful if this assertionFailure is removed.

Originally created by @kenjitayama on GitHub (Dec 23, 2020). Original GitHub issue: https://github.com/ProxymanApp/atlantis/issues/47 Originally assigned to: @NghiaTranUIT on GitHub. I get this assertion failure when using file URLs. ``` Fatal error: Only support HTTPURLResponse: file Atlantis/Packages.swift, line 209 ``` It can be reproduced with this code in an iOS app. ``` if let url = Bundle.main.url(forResource: "Info", withExtension: "plist") { let task = URLSession.shared.downloadTask(with: url) task.resume() } ``` In our app, many resources are retrieved from a web server, while some are bundled in the app. For a specific kind of resource, we want to use the same implementation for web and bundled file, which uses URLSessionDownloadTask. It would be helpful if this assertionFailure is removed.
kerem closed this issue 2026-03-03 19:11:10 +03:00
Author
Owner

@NghiaTranUIT commented on GitHub (Dec 23, 2020):

Thanks for opening this issue. I'm looking at it and remove it as possible 👍

<!-- gh-comment-id:749896633 --> @NghiaTranUIT commented on GitHub (Dec 23, 2020): Thanks for opening this issue. I'm looking at it and remove it as possible 👍
Author
Owner

@NghiaTranUIT commented on GitHub (Dec 23, 2020):

Hey @kenjitayama,

Can you share with us:

  1. Which iOS are you using?
  2. If you don't mind, can you provide a sample of your URL?

I tried to reproduce but it's working fine (Proxyman 2.15.1, iOS 14 and Atlantis 1.4.3)

        let url = URL(string: "https://proxyman.io/img/background/proxyman-dashboard-home.png")!
        let task = URLSession.shared.downloadTask(with: url)
        task.resume()
        let url = URL(string: "https://proxyman.io/img/background/proxyman-dashboard-home.png")!
        let task = URLSession.shared.downloadTask(with: url) { (_, response, error) in
            if let error = error {
                print(error)
                return
            }
            if let response = response as? HTTPURLResponse {
                print(response)
            }
        }
        task.resume()

Both URLSessionDownloadTasks are still working

Screen Shot 2020-12-23 at 10 15 25
<!-- gh-comment-id:749904017 --> @NghiaTranUIT commented on GitHub (Dec 23, 2020): Hey @kenjitayama, Can you share with us: 1. Which iOS are you using? 2. If you don't mind, can you provide a sample of your URL? I tried to reproduce but it's working fine (Proxyman 2.15.1, iOS 14 and Atlantis 1.4.3) ```swift let url = URL(string: "https://proxyman.io/img/background/proxyman-dashboard-home.png")! let task = URLSession.shared.downloadTask(with: url) task.resume() ``` ```swift let url = URL(string: "https://proxyman.io/img/background/proxyman-dashboard-home.png")! let task = URLSession.shared.downloadTask(with: url) { (_, response, error) in if let error = error { print(error) return } if let response = response as? HTTPURLResponse { print(response) } } task.resume() ``` Both URLSessionDownloadTasks are still working <img width="1792" alt="Screen Shot 2020-12-23 at 10 15 25" src="https://user-images.githubusercontent.com/5878421/102955267-1471f680-4508-11eb-92ff-4cefcd874bbb.png">
Author
Owner

@NghiaTranUIT commented on GitHub (Dec 23, 2020):

One more thing, when the assertionFailure occurs, can you print out the type of response variable?

The easier way is that you set the breakpoint at Atlantis/Packages.swift, line 209 and type po response to see the type and content.

<!-- gh-comment-id:749905076 --> @NghiaTranUIT commented on GitHub (Dec 23, 2020): One more thing, when the `assertionFailure` occurs, can you print out the type of response variable? The easier way is that you set the breakpoint at `Atlantis/Packages.swift, line 209` and type `po response` to see the type and content.
Author
Owner

@kenjitayama commented on GitHub (Dec 23, 2020):

@NghiaTranUIT Thanks for checking the issue!!

  1. Which iOS are you using?

I am using iOS 14.0 and Atlantis 1.4.3.

  1. If you don't mind, can you provide a sample of your URL?
    One more thing, when the assertionFailure occurs, can you print out the type of response variable?

Did this when assertionFailure occured (I changed the app name in the URL):

(lldb) po response
(NSURLResponse *) <0x283ec00e0> <NSURLResponse: 0x283ec00e0> { URL: file:///private/var/containers/Bundle/Application/CC649D79-6DC8-4B10-A4BA-E01A39E2275E/Example.app/Info.plist }

You need to use a file:// URL to reproduce.

<!-- gh-comment-id:749913044 --> @kenjitayama commented on GitHub (Dec 23, 2020): @NghiaTranUIT Thanks for checking the issue!! > 1. Which iOS are you using? I am using iOS 14.0 and Atlantis 1.4.3. > 2. If you don't mind, can you provide a sample of your URL? > One more thing, when the assertionFailure occurs, can you print out the type of response variable? Did this when assertionFailure occured (I changed the app name in the URL): ``` (lldb) po response (NSURLResponse *) <0x283ec00e0> <NSURLResponse: 0x283ec00e0> { URL: file:///private/var/containers/Bundle/Application/CC649D79-6DC8-4B10-A4BA-E01A39E2275E/Example.app/Info.plist } ``` You need to use a `file://` URL to reproduce.
Author
Owner

@NghiaTranUIT commented on GitHub (Dec 23, 2020):

Thanks. I'm able to reproduce this bug. Fixing now 👍

<!-- gh-comment-id:749920025 --> @NghiaTranUIT commented on GitHub (Dec 23, 2020): Thanks. I'm able to reproduce this bug. Fixing now 👍
Author
Owner

@NghiaTranUIT commented on GitHub (Dec 23, 2020):

@kenjitayama please check out the 1.5.0 version, which I've released (https://github.com/ProxymanApp/atlantis/releases/tag/1.5.0)

It fixes your problem 👍 Thank you and Merry Christmas 🎉

Screen Shot 2020-12-23 at 13 20 30
<!-- gh-comment-id:749965236 --> @NghiaTranUIT commented on GitHub (Dec 23, 2020): @kenjitayama please check out the 1.5.0 version, which I've released (https://github.com/ProxymanApp/atlantis/releases/tag/1.5.0) It fixes your problem 👍 Thank you and Merry Christmas 🎉 <img width="1792" alt="Screen Shot 2020-12-23 at 13 20 30" src="https://user-images.githubusercontent.com/5878421/102966773-1e552300-4523-11eb-81a5-10dff7ab032f.png">
Author
Owner

@kenjitayama commented on GitHub (Dec 23, 2020):

@NghiaTranUIT Thanks for the quick fix!
Confirmed the issue is resolved in our app.
It's nice that we could see file:// URLs in Proxyman too 👍
Merry Christmas 🎄

<!-- gh-comment-id:749984113 --> @kenjitayama commented on GitHub (Dec 23, 2020): @NghiaTranUIT Thanks for the quick fix! Confirmed the issue is resolved in our app. It's nice that we could see `file://` URLs in Proxyman too 👍 Merry Christmas 🎄
Author
Owner

@NghiaTranUIT commented on GitHub (Dec 23, 2020):

Glad to know it works 🎉

<!-- gh-comment-id:750045200 --> @NghiaTranUIT commented on GitHub (Dec 23, 2020): Glad to know it works 🎉
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/atlantis#36
No description provided.