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

Introduction


MKNetworkKit is an awesome networking framework written in Objective-C. This framework uses blocks and is ARC-ready. Although you have to write more code with MKNetworkKit over other networking frameworks such as AFNetworking, you gain more control on the working of the framework. You can download the framework from https://github.com/MugunthKumar/MKNetworkKit.

The MKNetworkKit framework consists of two main classes and a number of categories. The classes are as follows:

  • MKNetworkEngine: MKNetworkEngine manages the connections to a host. Some of the items that MKNetworkEngine manages are reachability, queues, hostname, and caching. To really take advantage of MKNetworkEngine you should subclass it for each unique host that you are connecting to.

  • MKNetworkOperation: This is a subclass of NSOperation; it wraps both the request and response classes. We can create a MKNetworkOperation class for each network operation that our application needs.

To use MKNetworkKit in our projects,...