How does iOS use AFNetworking 3.1.0 to add cookie to the request header?

When we use the AFNetworing company, the data processing is carried out on some number of encryption request data and some parameters in the request before adding cookie to handle the request header, so when the user login does not need to follow-up data in a request from some of the parameters, only need a cookie and URL you can fix the data request, at present most of our requests are to follow the HTTP protocol, the shoes can not clear their own Google, because of IPv6, directly explained in the AFNetworking 3.1.0 how to add cookie in the request header,

Since you want to add cookie, then you have to get this cookie, usually after the user login successfully, the server will return cookie in the request header, then we use AFNetworking 3.1.0 how to get this cookie? OK

Direct code

How does iOS use AFNetworking 3.1.0 to add cookie to the request header?

This Set-cookie will be in task.respose, and we’ll get the Set-cookie by instantiating NSHTTPURLResponse (this field can be obtained by printing the content)

That way, we can get this cookie, store it locally by persistent data, and then in the next request, hit the OK with the cookie, so how do you carry it? OK code to

How does iOS use AFNetworking 3.1.0 to add cookie to the request header?

Previously, through NSUserdefaults, here it is taken out directly, and by the agreed field into the request header, it is OK.

Well, that’s basically the case. You can either Google or ask me directly.