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 and using the MKNetworkKit engine

In this recipe we will be creating a subclass of MKNetworkEngine; this creates an iTunes engine to perform a search using the iTunes Web API. While it is not necessary to create a subclass of MKNetworkEngine for each host that you are connecting to, it is recommended.

There are three main advantages to subclassing MKNetworkEngine. They are as follows:

  • Each subclass of MKNetworkEngine contains its own Reachability object. This Reachability object will notify our class if there are changes in its availability or how we connect to the server.
  • Each subclass also contains its own set of queues for MKNetworkOperation.
  • You can customize an engine to the needs of a specific server.

For best practice, we want to set ...

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