I am pretty new to using Core Data, so I'd like to ask how I graphically add items to the database I am making. With graphically I mean like in navicat I can edit things with editor.
-
Please edit your question to clarify what you mean by 'graphically'. There is no drag & drop entity management at runtime of your application 'out of the box', if that is what you're looking for. – RyanR Jun 25 '11 at 03:12
3 Answers
May be am not clear with the term graphically. When you start creating your model using Core data, you need to choose a data model from project resources (of type .xcdatamodel) and when you select this,it wil open a model editor for you. you can create as many entities, related attributes and establish relationships. Hope this will help you.
~Manoj.

- 953
- 2
- 8
- 24
-
I mean like if I have made an entity called item, how I add more items to my database? – Samuli Lehtonen Jun 24 '11 at 23:22
-
Your application does that by calling appropriate methods in the Core Data API. If you want to pre-populate a data store to ship with your app, it's a simple matter to write a little utility program to do that. – Caleb Jun 25 '11 at 13:59
-
So can I just write a mac app that does it and copy the database file from the folder somehow? – Samuli Lehtonen Jun 25 '11 at 14:15
If you just need to instantiate a new entity and add it to your data store, you'll use the method insertNewObjectForEntityForName
on NSEntityDescription
to create a new instance of your entity and insert it into your context. You have to call saveChanges
on the context to persist that new entity to your data store. Core Data is a really powerful framework, but it isn't something most developers can just start using blindly. Read the Core Data guide, download some of the sample code, and you'll be rocking in no time.

- 7,728
- 1
- 25
- 39
Core Data is a object oriented framework that provides object persistence, not a visual database editor. Xcode contains a visual tool for creating and editing Core Data models, which are similar to database schemas, but there's no visual facility for managing or manipulating the data that a model describes. It can take a little while to understand Core Data; I'd suggest starting with Apple's Core Data Tutorial for iOS.

- 124,013
- 19
- 183
- 272
-
My app contains a lot of items which it has to display and they will be pre populated, do you still recommend core data or something else? – Samuli Lehtonen Jun 25 '11 at 14:10
-
I wouldn't recommend against Core Data based on the prepopulated data requirement -- Core Data can work fine for that. However, you'll need to come up with a way to enter the data. You might look for a third party tool (like one suggested [here](http://stackoverflow.com/q/1609683/643383) or just write your own -- it doesn't have to be fancy or complicated if you're just creating a little MacOS X application for your own use. – Caleb Jun 25 '11 at 16:15