Task nil when using Alamofire 5.0.0.rc2 - requires a delay
jsm174 opened this issue · 2 comments
jsm174 commented
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?
greenmood commented
faced the same issue. Got no answer yet.
greenmood commented
For future searchers Alamofire/Alamofire#3213