I create a class conforming to RequestRetrier :
public class OAuth2Handler: RequestRetrier {
public func should(_ manager: SessionManager, retry request: Request, with error: Error, completion: @escaping RequestRetryCompletion) {
print("Hello")
}
}
Later setup it:
Alamofire.SessionManager.default.retrier = OAuth2Handler()
let alamoReq = Alamofire.SessionManager.default.request(myRequest)
I try with errors 401 and 404 and should method never called. How to setup it right ?
Alamofire 4.0
iOS 10.0.1
@filippovdev,
Did you find a solution?
I'm with the same problem.
Solution:
You should chain validate()
to the request.
Not working
Most helpful comment
Solution:
You should chain
validate()
to the request.