Is it best to have all the Requests applications in AFNetworking 2 singleton?

Im using a subclass of AFHTTPSessionManager as a Singleton, as recommended by most tutorials. But Im coding is also that singleton absolutely requests ALL applications from logging in to get information about users and send to walls, etc. Everything is using blocks, so methods can be called from other places in the application using this singleton.

Thus, my client .m file becomes very large. I only do this in order to use the same AF client for all applications.

I thought each model class should have its own network methods. Ex. The custom class should have its own methods for updating the name, birthday, etc., but what happened to the singleton?

So, what is the best practice for using a singleton or for query management of each model class?

+4
source share

Source: https://habr.com/ru/post/1527759/


All Articles