Book Image

iOS and OS X Network Programming Cookbook

By : Jon Hoffman
Book Image

iOS and OS X Network Programming Cookbook

By: Jon Hoffman

Overview of this book

Table of Contents (15 chapters)
iOS and OS X Network Programming Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 from the iTunes Search API response.

Getting ready

You will need to download and add the AFNetworking to your project. You should also complete the Creating a web client using AFHTTPSessionManager recipe of this chapter since we will be elaborating...