Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-14-2010, 09:35 PM   #1 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 28
mbarron is on a distinguished road
Default Core data relationships from plist data

I have what is probably a very simple problem. My app loads data from two plists into core data (the plists are arrays of dictionaries). One Core Data entity is Person, the other entity is address. The relationship is to-one from person to address and to-many from address to person. In the plists, each person and address has a unique id and I have a key for each person that indicates the address its associated with.

My confusion is how to create this relationship as I load the data. Currently, my program loads all the addresses into coredata and then loads all the persons. I need to be able to point each person to the there associated address. Can someone point me in the right direction for what to do?

It seems like if I try to create both the address and person at the same time I'll be double creating some addresses (e.g. if person a & b live at address 1, I don't want to end up with two address 1s, I want both person a & b to the same address 1). I'm guessing that I need to create the addresses, then fetch them back so when I create each person I can associate it with the already created address. But I'm at a loss for how to do so.

Any guidance would be appreciated.
mbarron is offline   Reply With Quote
Old 02-14-2010, 10:53 PM   #2 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 28
mbarron is on a distinguished road
Default Solving my own dang problems

OK, figured it out (with a big assist from iphoneinaction.manning.com).

I was pretty much on the right track. What I need to do is indeed fetch back the address I already added to core data and then assign it to each person. I adapted the "setupCardPic" method describe in the link below and it works like a charm.

iPhone in Action: Core Data, Part 5: Prefilling Data
mbarron is offline   Reply With Quote
Old 04-15-2011, 03:02 AM   #3 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 1
notxcain is on a distinguished road
Default

Quote:
Originally Posted by mbarron View Post
OK, figured it out (with a big assist from iphoneinaction.manning.com).

I was pretty much on the right track. What I need to do is indeed fetch back the address I already added to core data and then assign it to each person. I adapted the "setupCardPic" method describe in the link below and it works like a charm.

iPhone in Action: Core Data, Part 5: Prefilling Data
please can you write you solution here. I have 404 on this link.
notxcain is offline   Reply With Quote
Reply

Bookmarks

Tags
core data, plists, relationships

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 329
5 members and 324 guests
2Apps1Day, akacaj, SLIC, soohyun, Techgirl-52
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,650
Threads: 94,115
Posts: 402,887
Top Poster: BrianSlick (7,990)
Welcome to our newest member, soohyun
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:07 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0