问题
My aim is to be able to catch whatever response in Alamofire requests (JSON, string) before my final competition handler is called and if it is a specific response code than I treat it the same for all responses.
I did a wrapper around Alamofire which let's me do specific requests I need (login request etc.) and there I catch the responses also, but I don't want to treat my error codes that are common globally in every specific request. It seems more naturally to just subclass Alamofire Request and make the treatment there.
But when I subclassed Alamofire Request class, in order for everything else to work I would also have to subclass Alamofire Manager and specifically override the method that returns the Request inside the manager. And that is not possible because inside that method the superclass uses it's own private stuff.
How should I proceed in order to make a more clean and nice solution?
来源:https://stackoverflow.com/questions/28903053/alamofire-treat-specific-error-codes