The Demo address

Github.com/tanghaitao/…

This paper covers the Serialization of the AFN Serialization, AFURLRequestSerialization and AFURLResponseSerialization two protocols, not a class

001 - NSCopying, NSObejct NSCoding protocol 002 - contentType 003 - person that many forms of data encapsulation 004 - stream call relationship between 005-006 - AFURLResponseSerializer 007 - summaryCopy the code

AFURLRequestSerialization

/* nsobject: the basic behavior of the oc object NSSecureCoding: throws an exception NSCodding: stores data NSCopying: a class that supports copying */ // NSCoding: Simple data storage model object - > file - > memory (don't need any file parsing, can not file to the file, direct use of NSData, archivedDataWithRootObject) / / exception file: Object VS key mismatch, Did not produce false data NSSecureCoding will throw exceptions () @ protocol AFURLRequestSerialization < NSObject, NSSecureCoding, NSCopying> + (BOOL)supportsSecureCoding{ return YES; [p copy] - (id)copyWithZone:(NSZone *)zone{NSLog(@" copy me :%@",self); return self; }}Copy the code

Reference github.com/tanghaitao/… ViewController2. M file

Content-Type

Get request: No content-type option in POST request: AfN request header content-type default is multiple forms, seri or content-type is JSON

// contentType ?
// request : request.httpBody
// request.httpBodyStream
// get  para  post para ?
// stream : cfreadStream writeStream?
Copy the code

Multiple forms of data encapsulation

Reference github.com/tanghaitao/… ViewController. M file