nativescript-community / nativescript-community/https

iOS StateProvider crash

Open
#110 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Vue
Stars
52
Forks
40
PR merge metrics
No merged PRs in 30d

Description

Doing Https.request, got error:
Alamofire/SessionDelegate.swift:49: Fatal error: StateProvider is nil for task 1.

Relevant Stack:

#4	0x00000001a28e5b54 in assertionFailure ()
#5	0x000000010610bc2c in SessionDelegate.request<Alamofire.DataRequest>(for:as:) at /Users/chris/Projects/Mantis/mantis_laser_trainer_app/platforms/ios/Pods/Alamofire/Source/Core/SessionDelegate.swift:49
#6	0x000000010610f40c in SessionDelegate.urlSession(_:dataTask:didReceive:) at /Users/chris/Projects/Mantis/mantis_laser_trainer_app/platforms/ios/Pods/Alamofire/Source/Core/SessionDelegate.swift:254

Code:

    func request<R: Request>(for task: URLSessionTask, as type: R.Type) -> R? {
        guard let provider = stateProvider else {
            assertionFailure("StateProvider is nil for task \(task.taskIdentifier).")
            return nil
        }

        return provider.request(for: task) as? R
    }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Https.request failure and tracing the lifecycle around Alamofire's platforms/ios/Pods/Alamofire/Source/Core/SessionDelegate.swift, especially lines 49 and 254. Determine why stateProvider is nil when the data-task callback runs; done means the crash is resolved for this request path and the failure is covered by an appropriate regression check.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios, swift
Domain
mobile-dev, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.