views:

970

answers:

1

This problem has been kicking my butt for a few days now.

I have a web service that serves XML that looks like this:

<levels>
    <level>Level 1</level>
    <level>Level 2</level>
    <level>Consulting</level>
    <level>Office Support</level>
    <level>Learning</level>
</levels>

This data needs to go into an entity in my Core Data model so that they can be used by my application. I've been able to parse them into the model just fine, my problem arises when one of the levels changes. I can create, read, and delete, but I can't figure out how to update because I need to maintain the relationships that exist with other entities in my model. I come from a strong PHP and MySQL background so my first instinct was to add a key to the model that I could use to relate, but since Core Data isn't really a database it feels wrong, and I know there must be a better way. I've searched Google a bit and could not find any answer. Am I on the right track with the key or does Core Data offer something I am missing?

+2  A: 

I'd need more information to understand exactly how your model works, but in general I don't think there's anything wrong to adding your own unique key to a Core Data model. I'm doing the same thing for one of my applications, I keep a UUID on each object for syncing with an iPhone application.

Marc Charbonneau