[GH-ISSUE #32] Fatal error: Could not get data from _swizzleURLSessionDataTaskDidReceiveResponseForIOS13AndLater. It might causes due to the latest iOS changes. Please contact the author!: file Atlantis/NetworkInjector+URLSession.swift, line 82 #26

Open
opened 2026-03-03 19:11:06 +03:00 by kerem · 3 comments
Owner

Originally created by @spnkr on GitHub (Nov 5, 2020).
Original GitHub issue: https://github.com/ProxymanApp/atlantis/issues/32

Originally assigned to: @NghiaTranUIT on GitHub.

getting Fatal error: Could not get data from _swizzleURLSessionDataTaskDidReceiveResponseForIOS13AndLater. It might causes due to the latest iOS changes. Please contact the author!: file Atlantis/NetworkInjector+URLSession.swift, line 82

caused by the assertion on line 82 of NetworkInjector+URLSession.swift--task is not a URLSessionDataTask, it's just a URLSessionTask.

if let task = me.value(forKey: "task") as? URLSessionDataTask,
   let response = response as? URLResponse {
    self?.delegate?.injectorSessionDidReceiveResponse(dataTask: task, response: response)
} else {
    assertionFailure("Could not get data from _swizzleURLSessionDataTaskDidReceiveResponseForIOS13AndLater. It might causes due to the latest iOS changes. Please contact the author!")
}

lldb debug info on task/`me.value(forKey: "task"):

(lldb) po me.value(forKey: "task") as? URLSessionDataTask
nil

(lldb) po type(of:me.value(forKey: "task"))
Swift.Optional<Any>

(lldb) po me.value(forKey: "task") is URLSessionTask
true

(lldb) po me.value(forKey: "task") is URLSessionDataTask
false

(lldb) po me.value(forKey: "task") is URLSessionStreamTask
false

(lldb) po me.value(forKey: "task") is URLSessionWebSocketTask
false

(lldb) po me.value(forKey: "task") is URLSessionUploadTask
false

here's the response object that triggered this


<NSHTTPURLResponse: 0x287a90600> { URL: https://foo.s3.amazonaws.com/folder/file.jpeg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=...&X-Amz-Date=...&X-Amz-Expires=...&X-Amz-Security-Token=...&X-Amz-Signature=...&X-Amz-SignedHeaders=host&response-content-disposition=attachment } { Status Code: 200, Headers {
    "Accept-Ranges" =     (
        bytes
    );
    "Content-Disposition" =     (
        attachment
    );
    "Content-Length" =     (
        21575
    );
    "Content-Type" =     (
        "image/jpeg"
    );
    Date =     (
        "Thu, 05 Nov 2020 10:25:55 GMT"
    );
    Etag =     (
        "\"...\""
    );
    "Last-Modified" =     (
        "Thu, 05 Nov 2020 10:25:39 GMT"
    );
    Server =     (
        AmazonS3
    );
    "x-amz-id-2" =     (
        "..."
    );
    "x-amz-meta-attachment-id" =     (
        ...
    );
    "x-amz-request-id" =     (
        ...
    );
    "x-amz-server-side-encryption" =     (
        AES256
    );
    "x-amz-version-id" =     (
        null
    );
} }

iOS 14.1 on device, built targeting iOS 13.2, xcode 12.1

Originally created by @spnkr on GitHub (Nov 5, 2020). Original GitHub issue: https://github.com/ProxymanApp/atlantis/issues/32 Originally assigned to: @NghiaTranUIT on GitHub. getting `Fatal error: Could not get data from _swizzleURLSessionDataTaskDidReceiveResponseForIOS13AndLater. It might causes due to the latest iOS changes. Please contact the author!: file Atlantis/NetworkInjector+URLSession.swift, line 82` caused by the assertion on line 82 of `NetworkInjector+URLSession.swift`--`task` is not a `URLSessionDataTask`, it's just a `URLSessionTask`. ``` if let task = me.value(forKey: "task") as? URLSessionDataTask, let response = response as? URLResponse { self?.delegate?.injectorSessionDidReceiveResponse(dataTask: task, response: response) } else { assertionFailure("Could not get data from _swizzleURLSessionDataTaskDidReceiveResponseForIOS13AndLater. It might causes due to the latest iOS changes. Please contact the author!") } ``` lldb debug info on `task`/`me.value(forKey: "task"): ``` (lldb) po me.value(forKey: "task") as? URLSessionDataTask nil (lldb) po type(of:me.value(forKey: "task")) Swift.Optional<Any> (lldb) po me.value(forKey: "task") is URLSessionTask true (lldb) po me.value(forKey: "task") is URLSessionDataTask false (lldb) po me.value(forKey: "task") is URLSessionStreamTask false (lldb) po me.value(forKey: "task") is URLSessionWebSocketTask false (lldb) po me.value(forKey: "task") is URLSessionUploadTask false ``` here's the `response` object that triggered this ``` <NSHTTPURLResponse: 0x287a90600> { URL: https://foo.s3.amazonaws.com/folder/file.jpeg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=...&X-Amz-Date=...&X-Amz-Expires=...&X-Amz-Security-Token=...&X-Amz-Signature=...&X-Amz-SignedHeaders=host&response-content-disposition=attachment } { Status Code: 200, Headers { "Accept-Ranges" = ( bytes ); "Content-Disposition" = ( attachment ); "Content-Length" = ( 21575 ); "Content-Type" = ( "image/jpeg" ); Date = ( "Thu, 05 Nov 2020 10:25:55 GMT" ); Etag = ( "\"...\"" ); "Last-Modified" = ( "Thu, 05 Nov 2020 10:25:39 GMT" ); Server = ( AmazonS3 ); "x-amz-id-2" = ( "..." ); "x-amz-meta-attachment-id" = ( ... ); "x-amz-request-id" = ( ... ); "x-amz-server-side-encryption" = ( AES256 ); "x-amz-version-id" = ( null ); } } ``` iOS 14.1 on device, built targeting iOS 13.2, xcode 12.1
Author
Owner

@NghiaTranUIT commented on GitHub (Nov 5, 2020):

Thanks for the debug bug report. I'm on it now 👍 😄

<!-- gh-comment-id:722299045 --> @NghiaTranUIT commented on GitHub (Nov 5, 2020): Thanks for the debug bug report. I'm on it now 👍 😄
Author
Owner

@NghiaTranUIT commented on GitHub (Nov 5, 2020):

Just wondering, what iOS version are you using? 🤔. I see 👍

<!-- gh-comment-id:722299613 --> @NghiaTranUIT commented on GitHub (Nov 5, 2020): ~Just wondering, what iOS version are you using? 🤔~. I see 👍
Author
Owner

@NghiaTranUIT commented on GitHub (Nov 5, 2020):

Please check out the release 1.3.0 (https://github.com/ProxymanApp/atlantis/releases/tag/1.3.0). It should fix your issue 👍

Thank you in advance 😄

<!-- gh-comment-id:722313075 --> @NghiaTranUIT commented on GitHub (Nov 5, 2020): Please check out the release 1.3.0 (https://github.com/ProxymanApp/atlantis/releases/tag/1.3.0). It should fix your issue 👍 Thank you in advance 😄
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#26
No description provided.