"Design is a plan for arranging elements in such a way as best to accomplish a particular purpose" — Charles Eames

LockGen is an iOS app that generates random string that can be used to lock specific vaults, accounts, and other classified documents. It can also save the generated string to it’s own secured internal library using Apple’s Core Data technology.

On my last post, you learned and became familiar with the template codes of Core Data. Now, you will learn how to model your own data using Core Data and you will modify the code to create to-dos instead of timeStamps. To build the to-do application, you will need to modify the data model by deleting the Event entity and adding a new one called ToDo.

The very first thing you need to do is modify the data model by deleting the Event entity, single-click on the Event entity and press delete on your keyboard. Once deleted, click the Add Entity button inside new entity mapping management area, a new entity will appear, name it ToDo. After you created the entity, try running the app and you will get an error that looks something like this:

2011-03-22 13:37:55.848 CoreDataModeling[6642:207] Unresolved error Error Domain=NSCocoaErrorDomain Code=134100 “The operation couldn’t be completed. (Cocoa error 134100.)” UserInfo=0x4d37da0 {metadata={type = immutable dict, count = 6,
entries =>
0 : {contents = “NSStoreModelVersionIdentifiers”} = {type = immutable, count = 0, values = ()}
2 : {contents = “NSStoreModelVersionHashesVersion”} = {value = +3, type = kCFNumberSInt32Type}
3 : {contents = “NSStoreType”} …

In this tutorial, you will learn how to work with Core Data and how to model your data for an enterprise-level apps. We will not program or anything but you will need Xcode for the modeling part of the tutorial.

Note: You can download Xcode 4 at http://developer.apple.com/ or via the Mac App Store
In this tutorial, I will mainly use Xcode 4 so some interface might be different with the one you’re using.

Open Xcode and create a new Navigation-based Application project but before clicking the “Choose…” button, make sure the Use Core Data for Storage is checked. Name your project Core Data Modeling (or whatever you want). I will be using Core Data Modeling for the entire tutorial.

Xcode 3

Look at the Resources folder and you’ll notice a .xcdatamodeld. Click the left disclosure triangle besides .xcdatamodeld and you’ll find another .xcdatamodel without a d at the end. Always remember that, xcdatamodeld is a package file that contains the core data files and xcdatamodel are the core data model.

Xcode 4

If you’re …

Pages

Copyright © 2010 - 2013 Studio Villegas. All Rights Reserved.