[GH-ISSUE #33] Assertion failure in _swizzleURLSessionDataTaskDidReceiveResponseForIOS13AndLater #28

Closed
opened 2026-03-03 19:11:06 +03:00 by kerem · 5 comments
Owner

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

Originally assigned to: @NghiaTranUIT on GitHub.

Version: 1.2.0 (d918263) integrated using SPM.
Device: Simulator running iOS 13.0.

This happens in NetworkInjector+URLSession.swift:82, due to a failed safe-check in this line:

if let task = me.value(forKey: "task") as? URLSessionDataTask

The response URL is starting with https://app-measurement.com/config/app/.... So most likely, this is a request sent by Firebase SDK (namely Firebase Remote Config feature).

Some LLDB info:

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

nil

po type(of: me.value(forKey: "task")!)

__NSCFLocalDownloadTask

po dump(me.value(forKey: "task")!)

- LocalDownloadTask <20850171-C07B-4A76-9195-08F62CCB7ACC>.<1> #0
  - super: __NSCFLocalSessionTask
    - super: __NSCFURLSessionTask
      - super: NSURLSessionTask
        - super: NSObject
LocalDownloadTask <20850171-C07B-4A76-9195-08F62CCB7ACC>.<1>
p me.value(forKey: "task")!
Any) $R96 = {
  payload_data_0 = 0x00007fe1e4601ce0 {
    base__NSCFLocalSessionTask@0 = {
      base__NSCFURLSessionTask@0 = {
        baseNSURLSessionTask@0 = {
          baseNSObject@0 = {
            isa = __NSCFLocalDownloadTask
          }
          _nw_activity_ivar = nil
          _metrics_ivar = 0x000060000191c360
          earliestBeginDate = nil
          _private_nw_activity = nil
          __taskGroup = 0x00007fe1e4503dc0
        }
        _cachedSocketStreamProperties = 0x0000600003d52780
        _httpConnectionInfoCompletionBlock = nil
        _taskIdentifier = 1
        _taskDescription = nil
        _loggableDescription = 0x0000600001ea0af0 "Task <20850171-C07B-4A76-9195-08F62CCB7ACC>.<1>"
        _originalRequest = some {
          some = 0x0000600003f09930 {
            baseNSURLRequest@0 = {
              baseNSObject@0 = {
                isa = NSMutableURLRequest
              }
              _internal = 0x0000600000606f20
            }
          }
        }
        _currentRequest = some {
          some = 0x0000600003f31850 {
            baseNSURLRequest@0 = {
              baseNSObject@0 = {
                isa = NSMutableURLRequest
              }
              _internal = 0x000060000060e2f0
            }
          }
        }
        _response = some {
          some = 0x0000600003c205c0 {
            baseNSURLResponse@0 = {
              baseNSObject@0 = {
                isa = NSHTTPURLResponse
              }
              _internal = 0x0000600001640460
            }
            _httpInternal = 0x0000600003c20200
          }
        }
        _countOfBytesClientExpectsToSend = -1
        _countOfBytesClientExpectsToReceive = -1
        _countOfBytesReceived = 0
        __countOfPendingBytesReceivedEncoded = 0
        __countOfBytesReceivedEncoded = 0
        _countOfBytesSent = 0
        _countOfBytesExpectedToSend = 0
        _countOfBytesExpectedToReceive = -1
        _state = 0
        _error = nil
        _startTime = 626263406.09285104
        __TCPConnectionMetadata = nil
        _TLSNegotiatedCipherSuite = 4865
        _priorityHint = 0.5
        _priorityValue = 300
        _loadingPriorityValue = 0.5
        _bytesPerSecondLimitValue = 0
        _expectedProgressTargetValue = 0
        _backgroundTransactionMetrics = nil
        _legacySocketStreamProperties = nil
        _cfHSTS = 0x0000000000000000
        _cfCache = 0x0000000000000000
        _cfCreds = 0x0000000000000000
        _cfCookies = 0x0000000000000000
        _cachePolicy = 1
        _timeoutInterval = 60
        _timeoutIntervalForResource_ivar = 60
        _proxySettings = nil
        _sslSettings = 0x0000600003d51ea0
        _cookieAcceptPolicy = 2
        _contentDispositionFallbackArray = nil
        _networkServiceType = 0
        _qos = 9
        _voucher = nil
        _suspensionThreshhold = 524288
        _boundInterfaceIdentifier = nil
        _allowedProtocolTypes = 0
        _requestPriority = -1
        _expectedWorkload = 0
        _timeWindowDelay = 0
        _timeWindowDuration = 0
        _uniqueIdentifier = 0x0000600003c364e0
        _powerAssertion = 0
        _darkWakePowerAssertion = 0
        _effectiveConfiguration = 0x0000600003f096c0
        _protocolForTask = nil
        _authenticator = nil
        _storagePartitionIdentifier = nil
        _parentDocumentURL = nil
        _siteForCookies = nil
        _dependencyInfo_ivar = 0x0000600003c3acc0 1 key/value pair
        _DuetActivityProperties = nil
        _dependencyTree = nil
        _taskDependency = nil
        _pathToDownloadTaskFile = nil
        _trailers = nil
        _discretionaryOverride = 0
        _appleIDContext = nil
        _progress = nil
        _uploadProgress = nil
        _downloadProgress = nil
        _publishingURL = nil
        _backgroundPublishingURL = nil
        _APSRelayTopic = nil
        _extractor = nil
        _extractorFinishedDecoding = false
        _hasSZExtractor = false
        _doesSZExtractorConsumeExtractedData = false
        _shouldSkipPreferredClientCertificateLookup = false
        _cacheOnly = false
        _preventsSystemHTTPProxyAuthentication = false
        _requiresSecureHTTPSProxyConnection = false
        _preventsAppSSO = false
        _appSSOFallback = false
        _shouldPipelineHTTP = false
        _shouldUsePipelineHeuristics = false
        _shouldSkipPipelineProbe = false
        _shouldHandleCookies = true
        _isTopLevelNavigation = false
        _prohibitAuthUI = false
        _strictContentLength = true
        _connectionIsCellular = false
        _disallowCellular = false
        _allowsCellular = true
        _allowsExpensiveOverride = 0
        _allowsConstrainedOverride = 0
        _allowsCellularOverride = 0
        _isInUpload = false
        _undeterminedUploadProgressState = false
        _undeterminedDownloadProgressState = false
        _progressReportingFinished = false
        _allowsQUIC = false
        _preventsIdleSystemSleep = false
        _preconnect = false
        _authenticatorConfiguredViaTaskProperty = false
        _seenFirstResume = true
        _atsStateCache = 0x00006000023a5700
        _connectionIsCompanionLink = false
        _extractorPreparedForExtraction = false
      }
      _cfConn = 0x000060000086f840
      _uploadFile = nil
      _dataTaskData = nil
      _dataTaskCompletion = nil
      _pendingResponseBytes = nil
      _suspendCount = 0
      _async_initialization = nil
      _resourceTimeout = some {
        some = 0x0000600001318a80 {
          baseOS_dispatch_object@0 = {
            baseOS_object@0 = {
              baseNSObject@0 = {
                isa = OS_dispatch_source
              }
            }
          }
        }
      }
      _startTimeoutTime = 0
      _startTimeoutTimer = nil
      _payloadTransmissionTimer = nil
      _willSendRequestTimer = nil
      _socketReadStreamForUpgrade = nil
      _socketWriteStreamForUpgrade = nil
      _extraBytes = nil
      _connectionWorkQueue = nil
      _connectionWorkQueueSuspensionCount = 0
      _pendingResponseDisposition = false
      _pendingResponseDisposition_didFinish = false
      _didIssueWaitingForConnectivity = false
      _didIssueDidFinish = false
      _suspendedForDisposition = false
      _didCheckMixedReplace = true
      _isMixedReplace = false
    }
    _fileCompletion = nil
    _downloadFile = 0x000060000060e080
    _writeBuffer = nil
    _ioSuspend = 0
    _totalWrote = 0
    _resumeCallback = nil
    _initialResumeSize = -1
    _originalResumeInfo = nil
    _transientWriteProgress = 0
    _afterDidReportProgressOnQueue = nil
    _dataAckCompletion = nil
    _seqNo = 0
    _canWrite = true
    _suppressProgress = false
    _needFinish = false
    _didIssueNeedFinish = false
  }
  payload_data_1 = 0x000000010e8e5a00
  payload_data_2 = 0x00007fe1e4879628
  instance_type = 0x00007fe1e4879628
Originally created by @advantis on GitHub (Nov 5, 2020). Original GitHub issue: https://github.com/ProxymanApp/atlantis/issues/33 Originally assigned to: @NghiaTranUIT on GitHub. Version: 1.2.0 (d918263) integrated using SPM. Device: Simulator running iOS 13.0. This happens in `NetworkInjector+URLSession.swift:82`, due to a failed safe-check in this line: ```swift if let task = me.value(forKey: "task") as? URLSessionDataTask ``` The response URL is starting with `https://app-measurement.com/config/app/...`. So most likely, this is a request sent by Firebase SDK (namely Firebase Remote Config feature). ### Some LLDB info: **po me.value(forKey: "task") as? URLSessionDataTask** ``` nil ``` **po type(of: me.value(forKey: "task")!)** ``` __NSCFLocalDownloadTask ``` **po dump(me.value(forKey: "task")!)** ``` - LocalDownloadTask <20850171-C07B-4A76-9195-08F62CCB7ACC>.<1> #0 - super: __NSCFLocalSessionTask - super: __NSCFURLSessionTask - super: NSURLSessionTask - super: NSObject LocalDownloadTask <20850171-C07B-4A76-9195-08F62CCB7ACC>.<1> ``` <details> <summary>p me.value(forKey: "task")!</summary> ``` Any) $R96 = { payload_data_0 = 0x00007fe1e4601ce0 { base__NSCFLocalSessionTask@0 = { base__NSCFURLSessionTask@0 = { baseNSURLSessionTask@0 = { baseNSObject@0 = { isa = __NSCFLocalDownloadTask } _nw_activity_ivar = nil _metrics_ivar = 0x000060000191c360 earliestBeginDate = nil _private_nw_activity = nil __taskGroup = 0x00007fe1e4503dc0 } _cachedSocketStreamProperties = 0x0000600003d52780 _httpConnectionInfoCompletionBlock = nil _taskIdentifier = 1 _taskDescription = nil _loggableDescription = 0x0000600001ea0af0 "Task <20850171-C07B-4A76-9195-08F62CCB7ACC>.<1>" _originalRequest = some { some = 0x0000600003f09930 { baseNSURLRequest@0 = { baseNSObject@0 = { isa = NSMutableURLRequest } _internal = 0x0000600000606f20 } } } _currentRequest = some { some = 0x0000600003f31850 { baseNSURLRequest@0 = { baseNSObject@0 = { isa = NSMutableURLRequest } _internal = 0x000060000060e2f0 } } } _response = some { some = 0x0000600003c205c0 { baseNSURLResponse@0 = { baseNSObject@0 = { isa = NSHTTPURLResponse } _internal = 0x0000600001640460 } _httpInternal = 0x0000600003c20200 } } _countOfBytesClientExpectsToSend = -1 _countOfBytesClientExpectsToReceive = -1 _countOfBytesReceived = 0 __countOfPendingBytesReceivedEncoded = 0 __countOfBytesReceivedEncoded = 0 _countOfBytesSent = 0 _countOfBytesExpectedToSend = 0 _countOfBytesExpectedToReceive = -1 _state = 0 _error = nil _startTime = 626263406.09285104 __TCPConnectionMetadata = nil _TLSNegotiatedCipherSuite = 4865 _priorityHint = 0.5 _priorityValue = 300 _loadingPriorityValue = 0.5 _bytesPerSecondLimitValue = 0 _expectedProgressTargetValue = 0 _backgroundTransactionMetrics = nil _legacySocketStreamProperties = nil _cfHSTS = 0x0000000000000000 _cfCache = 0x0000000000000000 _cfCreds = 0x0000000000000000 _cfCookies = 0x0000000000000000 _cachePolicy = 1 _timeoutInterval = 60 _timeoutIntervalForResource_ivar = 60 _proxySettings = nil _sslSettings = 0x0000600003d51ea0 _cookieAcceptPolicy = 2 _contentDispositionFallbackArray = nil _networkServiceType = 0 _qos = 9 _voucher = nil _suspensionThreshhold = 524288 _boundInterfaceIdentifier = nil _allowedProtocolTypes = 0 _requestPriority = -1 _expectedWorkload = 0 _timeWindowDelay = 0 _timeWindowDuration = 0 _uniqueIdentifier = 0x0000600003c364e0 _powerAssertion = 0 _darkWakePowerAssertion = 0 _effectiveConfiguration = 0x0000600003f096c0 _protocolForTask = nil _authenticator = nil _storagePartitionIdentifier = nil _parentDocumentURL = nil _siteForCookies = nil _dependencyInfo_ivar = 0x0000600003c3acc0 1 key/value pair _DuetActivityProperties = nil _dependencyTree = nil _taskDependency = nil _pathToDownloadTaskFile = nil _trailers = nil _discretionaryOverride = 0 _appleIDContext = nil _progress = nil _uploadProgress = nil _downloadProgress = nil _publishingURL = nil _backgroundPublishingURL = nil _APSRelayTopic = nil _extractor = nil _extractorFinishedDecoding = false _hasSZExtractor = false _doesSZExtractorConsumeExtractedData = false _shouldSkipPreferredClientCertificateLookup = false _cacheOnly = false _preventsSystemHTTPProxyAuthentication = false _requiresSecureHTTPSProxyConnection = false _preventsAppSSO = false _appSSOFallback = false _shouldPipelineHTTP = false _shouldUsePipelineHeuristics = false _shouldSkipPipelineProbe = false _shouldHandleCookies = true _isTopLevelNavigation = false _prohibitAuthUI = false _strictContentLength = true _connectionIsCellular = false _disallowCellular = false _allowsCellular = true _allowsExpensiveOverride = 0 _allowsConstrainedOverride = 0 _allowsCellularOverride = 0 _isInUpload = false _undeterminedUploadProgressState = false _undeterminedDownloadProgressState = false _progressReportingFinished = false _allowsQUIC = false _preventsIdleSystemSleep = false _preconnect = false _authenticatorConfiguredViaTaskProperty = false _seenFirstResume = true _atsStateCache = 0x00006000023a5700 _connectionIsCompanionLink = false _extractorPreparedForExtraction = false } _cfConn = 0x000060000086f840 _uploadFile = nil _dataTaskData = nil _dataTaskCompletion = nil _pendingResponseBytes = nil _suspendCount = 0 _async_initialization = nil _resourceTimeout = some { some = 0x0000600001318a80 { baseOS_dispatch_object@0 = { baseOS_object@0 = { baseNSObject@0 = { isa = OS_dispatch_source } } } } } _startTimeoutTime = 0 _startTimeoutTimer = nil _payloadTransmissionTimer = nil _willSendRequestTimer = nil _socketReadStreamForUpgrade = nil _socketWriteStreamForUpgrade = nil _extraBytes = nil _connectionWorkQueue = nil _connectionWorkQueueSuspensionCount = 0 _pendingResponseDisposition = false _pendingResponseDisposition_didFinish = false _didIssueWaitingForConnectivity = false _didIssueDidFinish = false _suspendedForDisposition = false _didCheckMixedReplace = true _isMixedReplace = false } _fileCompletion = nil _downloadFile = 0x000060000060e080 _writeBuffer = nil _ioSuspend = 0 _totalWrote = 0 _resumeCallback = nil _initialResumeSize = -1 _originalResumeInfo = nil _transientWriteProgress = 0 _afterDidReportProgressOnQueue = nil _dataAckCompletion = nil _seqNo = 0 _canWrite = true _suppressProgress = false _needFinish = false _didIssueNeedFinish = false } payload_data_1 = 0x000000010e8e5a00 payload_data_2 = 0x00007fe1e4879628 instance_type = 0x00007fe1e4879628 ``` </details>
kerem 2026-03-03 19:11:06 +03:00
  • closed this issue
  • added the
    Done
    bug
    labels
Author
Owner

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

Thank. It's related with #32. I'm fixing it now 👍

<!-- gh-comment-id:722304762 --> @NghiaTranUIT commented on GitHub (Nov 5, 2020): Thank. It's related with #32. I'm fixing it now 👍
Author
Owner

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

Right. Excuse me for the duplicate then. I searched for the existing issue before hitting that "New issue" button but looks like we reported almost simultaneously. Please feel free to close this to avoid duplicates, and please let me know in case you need any additional info.

<!-- gh-comment-id:722309802 --> @advantis commented on GitHub (Nov 5, 2020): Right. Excuse me for the duplicate then. I searched for the existing issue before hitting that "New issue" button but looks like we reported almost simultaneously. Please feel free to close this to avoid duplicates, and please let me know in case you need any additional info.
Author
Owner

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

@advantis it's done with Atlantis 1.3.0 (https://github.com/ProxymanApp/atlantis/releases/tag/1.3.0).

Please update your pod 😍

<!-- gh-comment-id:722313446 --> @NghiaTranUIT commented on GitHub (Nov 5, 2020): @advantis it's done with Atlantis 1.3.0 (https://github.com/ProxymanApp/atlantis/releases/tag/1.3.0). Please update your pod 😍
Author
Owner

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

Please let me know if it works for you 👍

<!-- gh-comment-id:722313606 --> @NghiaTranUIT commented on GitHub (Nov 5, 2020): Please let me know if it works for you 👍
Author
Owner

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

Yep, everything works great, thank you!

<!-- gh-comment-id:722323282 --> @advantis commented on GitHub (Nov 5, 2020): Yep, everything works great, thank you!
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#28
No description provided.