Beginning Core Data with RubyMotion
Beginning Core Data with RubyMotion
About the Book
Core Data programming is hard. Apple warn as much in their document Core Data Core Competencies, "Important: Core Data is an advanced technology that is not required for creating simple applications". That doesn't sound so severe perhaps but it does contrast greatly with the rest of the developer documentation that seems to suggest that iOS/OSX programming is made easy by all the frameworks and widgets ready for us to customise and use in our applications.
Compared to many other Apple frameworks, Core Data seems to be considerably less developer-friendly. Compare it then to the elegance of the RubyMotion framework and the constrast becomes more stark. How are we to define our models, relationships and migrations without the tools that Xcode provides?
In this book we set out exactly how you can create Core Data-powered apps using RubyMotion that are ready for the app store, including preparing for the future by learning the ins and outs of schema and data migrations. Below is an outline of the topics we cover:
- An Overview of the Core Data architecture
- Setting up the Core Data stack in RubyMotion
- Modelling your data without Xcode
- Managing Schema Migrations
- Handling Data (Heavyweight) Migrations
- Adding undo/redo Management to your app
- Tips to get unstuck when faced with common Core Data issues
All sample code is available on GitHub.
Table of Contents
-
1. Introduction
- Core Data
- RubyMotion
- Core Data & RubyMotion
- Technical Notes and Bugs
- Structure of this Book
-
2. Diving into Core Data
- App Structure
- The Core Data Stack
- Setting up our Entities
- Setting up the Stack
- Creating, Reading, Updating and Deleting Records
- Searching and Sorting
- Wrapping Up
-
3. Core Data Models Without Xcode
- Getting Started
- Defining a Model
- A First Migration
- Second Migration: Adding a Related Model
- Testing Both Migrations Together
- Saving and Retrieving Records
- Wrapping Up
-
4. Core Data Query
- Getting Started
- Migrations
- Displaying our Tasks
- Adding a Relationship
- Performing Aggregate Queries
-
5. Case Study: Core Data Books
- The Model
- The Core Data Stack
- The Root View Controller
- Responding to Changes
- Implementing the Detail View Controller
- Adding New Books
- Adding Undo and Redo Capabilities
- Wrapping Up
-
6. Data Migrations
- Overview
- Getting Started
- Setting up the Migration Process
- The First Schema Migration
- The Data Migration
- The Final Schema Migration
- Wrapping Up
-
7. Tips & Troubleshooting
- Debugging Core Data
- Interacting With Views in the Console
- Uninitialized constant NSSQLiteStoreType
- Undefined method `viewWillAppear’
- Other Errors and Crashes
Causes Supported

Brittle Bone Society
http://www.brittlebone.org/The Brittle Bone Society is the only charity working with people who live with Osteogenesis Imperfecta(OI) and supports over 820 members and their families across the UK and the Republic of Ireland. Our work involves addressing isolation and facilitating networking opportunities.
The Leanpub 60-day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms
80% Royalties. Earn $16 on a $20 book.
We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them