Creating a custom response serializer
In the Creating a web client using AFHTTPSessionManager recipe of this chapter, we used AFJSONResponseSerializer
, which comes with AFNetworking, to serialize the response that is returned from the iTunes Search API. The standard AFNetworking response serializers work well for simple responses, but what if we want to create a custom serializer that would parse the response for us rather than just send back an NSDictionary
object? We can subclass any of the response serializers provided by AFNetworking to accomplish that.
In this recipe, we will be subclassing AFJSONResponseSerializer
so that our ITunesClient
class returns an NSArray
object that contains an array of objects that in turn contains the information ...
Get iOS and OS X Network Programming Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.