Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I automatically generate a Core Data GUI in Xcode 4?

I am working my way through Learn Cocoa on the Mac which was written based on Xcode 3, and I am using v4. So far I have been able to fairly easily find my way around the differences, but now I am on a chapter introducing Core Data and there's a part about being able to automatically generate a GUI by Option+dragging from an entity to a window in IB, but I don't seem to be able to do this in Xcode 4. Is it still possible, or did that ability die with v3? And more importantly, how do I do this?

This are the instructions in the book:

Start by going back to Xcode’s navigation pane. Go into the Resources group and double-click MainMenu.xib to open it in Interface Builder. This brings up a nib file much like you’ve seen in earlier, including a menu and an empty window. Bring the empty window to the front (double-click on its icon in the main window if the window isn’t showing), and make it a bit bigger; somewhere about 500 x 600 will do nicely.

Now go back to Xcode, and bring up your model file if it isn’t still showing. What you’re going to do is ⌥-drag the MythicalPerson entity from the graph paper workspace over to the blank window in Interface Builder. Start by holding down ⌥, then click and hold on the box representing the MythicalPerson entity. Keep holding the mouse and drag away, and you’ll see a translucent copy of the entity box being pulled along with your mouse pointer. Once the drag is started, you can release the ⌥ button. Now drag the entity over the empty window in Interface Builder. If you can’t see it, use ⌘Tab to switch back to Interface Builder (while still holding down the mouse button!), drag over the middle of the empty window, and release the mouse button.

Now you’ll be presented with the New Core Data Entity Interface assistant

Any hints? Thanks!

like image 920
peterlcole Avatar asked Jul 16 '11 03:07

peterlcole


People also ask

How do I create a Core Data model?

Add a Core Data Model to an Existing ProjectChoose File > New > File and select the iOS platform tab. Scroll down to the Core Data section, select Data Model, and click Next. Name your model file, select its group and targets, and click Create.

When should I use Core Data?

Use Core Data to save your application's permanent data for offline use, to cache temporary data, and to add undo functionality to your app on a single device. To sync data across multiple devices in a single iCloud account, Core Data automatically mirrors your schema to a CloudKit container.

What is Core Data in Xcode?

Core Data is a framework that you use to manage the model layer objects in your application. It provides generalized and automated solutions to common tasks associated with object life cycle and object graph management, including persistence.


1 Answers

If anyone is struggling with chapter 7 because of the removal of the Core Data Interface Assistant from XCode 4 then follow the guide here to get you back on track: http://www.swampfoetus.net/chapter-7-fail/

like image 187
swampf0etus Avatar answered Nov 15 '22 10:11

swampf0etus