objective c - Is there a way to register custom accept headers to parse as JSON in AFNetworking 1.3? -
i have server sending json using following accept header:
[self setdefaultheader:@"accept" value:@"application/vnd.com.test.v1+json"]; in success block of api calls, response data coming nsdata object.
i read in following question issue retrieving json afnetworking need set @"application/json" if want json parsed nsdictionary automatically, otherwise have manually each call using nsjsonserialization.
is there way can @"application/vnd.com.test.v1+json" recognized json , automatically json deserialization each request?
add desired content types afhttprequestoperation using addacceptablecontenttypes::
[afjsonrequestoperation addacceptablecontenttypes:[nsset setwithobject:@"application/vnd.com.test.v1+json"];
Comments
Post a Comment