O'Reilly logo

iOS and OS X Network Programming Cookbook by Jon Hoffman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required