200 OK 200 OK - 1 month ago 9
iOS Question

How can I send common information will all the AFNetworking Request?

I am using

for my client and server communication. I want to make a
on top of AFNetworking so that I can set common header and extra information for all the HTTP requests. Basically all my HTTP request will go through one layer to AFNetworking. It will make my client server communication easier and I will be able to include any kind of data with all the http request at any point of time. What will be the best way to do it?

As example I want to send token, network status, user info etc.

More specifically:

I want to include some common info with all the request like network info, user info, token. Now its really difficult to change in each and every request. So I want to design in such a way that all the http call will go through one path and I can send anything with
AFNetworking HTTP Request
without touching all the file.


You should create one separate class that manage all the network related calls. You should subclass NSObject and make a class with different required methods that you need. Import your AFNetwotking in this class and use this class in whole project when needed to make network call!