Alamofire treat specific error codes

前提是你 提交于 2019-12-25 04:11:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!