Book Image

RestKit for iOS

By : Taras Kalapun
Book Image

RestKit for iOS

By: Taras Kalapun

Overview of this book

<p>RestKit is an iOS framework for streamlining communication with web services, and it relies on the AFNetworking library that is used by thousands of app developers. It has an interface that is elegant and well designed, and it provides a powerful object-mapping engine that integrates well with the CoreData database. RestKit for iOS will teach you everything from loading a simple list of objects to creating a fully-featured app.<br /><br />RestKit for iOS delivers constructive tools and insights into app development that will benefit any app developer. The book starts with a simple example and then moves on to more complex ones as your knowledge increases. By the end of the guide, you will be able to build a fully-featured app that uses RESTful web services and performs CRUD object manipulation.<br /><br />RestKit for iOS will provide you with all the information you need to boost the development process of both simple and complex apps. Once you have executed a simple example and reviewed the basic theory, you will move on to more advanced concepts with descriptions of real-life scenarios and how to overcome bottlenecks. RestKit for iOS is full of real-life examples that show you how to simplify data loading, basic and advanced object mapping, metadata mapping, and routing. This book also teaches you about routing, RESTful object manipulation and synchronization, integration with the user interface, and caching</p>
Table of Contents (13 chapters)

Preface

You can ask yourself the question, "Why would I read the book about this library?" Of course, you can read the RestKit documentation. It's a perfect example of how to write down a good API reference for a framework. On the other hand, you can dive into researching the RestKit test cases, which is also nice and interesting, as the unit tests are covering almost all the functionalities of a framework. However, it won't make you happy.

While reading the API documentation is nice and it is full of simple examples for every class, it won't help you understand how to easily apply the framework in your daily jobs. Therefore, the key goal of this book is to provide guidance and real-life usage examples. We will start from a basic example of how to load a simple list of objects to creating a full-featured app, with advanced mapping techniques, Core Data integration, and so on.

What this book covers

Chapter 1, Getting Started, starts with the key concepts of RestKit, describes how to install it, and shows a short example of basic data loading.

Chapter 2, Modeling and Loading Remote Objects, describes how to configure RestKit and data mapping, how to use one-line methods to load objects and push them back to the server, and how to integrate the code with nice UI.

Chapter 3, Persistence with Core Data, describes how to make RestKit persist and synchronize data with Core Data databases.

Chapter 4, Advanced Stuff, covers some more advanced features of RestKit and AFNetworking libraries that developers might use in everyday app development and will help overcome potential bottlenecks.

Appendix A, Helpful Resources, lists links to nice guides that might be useful to a developer.

Appendix B, Helpful Libraries, lists links and describes some popular libraries that might be useful for developing iOS apps.

What you need for this book

A free Apple iOS Developer account with Xcode 4.5 running in OS X, and an Internet connection for downloading the RestKit and related libraries.

Who this book is for

iOS developers of all levels who are interested in boosting their productivity by using third-party libraries with a willingness to learn how to build RESTful apps using the RestKit framework. Basic knowledge of Objective-C is required and a simple understanding of how Core Data works.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "It heavily uses tables (such as UITableViewController) to present the loaded data (list of objects) to the user."

A block of code is set as follows:

// in MDatabase @implementation
- (NSString *)titleText
{
    return self.name;
}

- (NSString *)subtitleText
{
    return self.plan;
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

[self setupObjectManager];

// Setup CoreData stack after Object Manager
[self setupCoreData];
[self setupMappings];

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "A Save button is added to the navigation controller, it triggers the saveAction method with the following code."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.