Re: creating new instance of coredata entity
Re: creating new instance of coredata entity
- Subject: Re: creating new instance of coredata entity
- From: Jamie Hardt <email@hidden>
- Date: Thu, 11 Sep 2008 10:39:29 -0700
Ah I see. XML on web -> your program -> sqlite store that someone
else's program reads/writes.
Looping over the data in the table should just be a matter of going
through all of the items in the table's bound NSArrayController:
//code
NSArray *objectsToLoopThru = [myArrayControllerWithRecordsFromTheWeb
arrangedObjects];
foreach (id oneObject in objectsToLoopThru) {
//create entity
// write entity
}
//endcode
Writing to someone elses data format is a bit trickier, since as you
say, you don't have access to his data model. One alternative is to
use the low-level SQLite API to manual insert rows into his database,
but a better one might be to read out a format that can be cut/pasted
or imported into the third-party's application. Does the other guy's
app have an import function? Since it seems to be handling people,
does it allow contacts to be imported from the Addressbook or vcards,
in which case you could just write out the scraped rows to the
ABAddressBook and use it as a channel.
Just a thought, take or leave. If I were in your situation I would
consider writing to the third party's document as a *last option*,
since there's so many more opportunities for it to break in the future.
On Sep 11, 2008, at 10:22 AM, Amy Heavey wrote:
I need to add data from the website to the sqlite file created/used
by the cocoa application.
I can pull the data in XML out of the website, and display it in a
tableview (Aaron Hillegass sample code), but now I need to add that
data to my app (stored in an sqlite file)
each row of the tableview contains all of the data needed, eg I have
customers first name, last name, email address, and in the datamodel
there is a Customer Entity (class CustomerEntity) with a firstName
and lastName attributes, and an emailaddresses relationship.
I don't know how to loop over the tableviewdata creating new
instances of the entity?
Many Thanks
Amy Heavey
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden