Skip to content
This repository was archived by the owner on Jan 26, 2021. It is now read-only.

Task nil when using Alamofire 5.0.0.rc2 - requires a delay #13

@jsm174

Description

@jsm174

I realize Alamofire 5 is not yet out, but when doing some testing with 5.0.0.rc2, a GraphQL request will result in a crash:

return request.responseJSON { response in
.
.
.
}.task!

Unexpectedly found nil while unwrapping an Optional value

After running through the debugger, task isn't always created right away.

As a temporary hack solution, I added a usleep:

 let request = sessionManager
                .request(url, method: .post, parameters: body,
                         encoding: JSONEncoding.default, headers: headers)
                .validate(statusCode: [200])
            
 usleep(500)
            
 if loggingEnabled {
    debugPrint(request)
 }

Has anyone else experienced this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions