views:

769

answers:

2

I'm currently migrating my sqllite application to using core data. When I created the data model I noticed that an attribute can be marked as and Identity property. Happily I marked that attribute as required and indexable only to find out that I have to supply the value myself or the insert of the entity fails, which kind of takes away from the idea of the data store providing the identity for me.

So if the identity property doesn't work like I thought it does, does anyone as any idea what its for?

Digging in the documentation and on this site it became clear that core-data as it's own identity object. Is this what I'm suppose to use? Is this how relations are created between entities?

A: 

You aren't supposed to worry about CoreData's internal identity but rather manage your relationships by creating the proper relationship associations in the CoreData designer and associating actual objects rather than ids.

Greg Martin
Thanks greg. Any idea what's the identity attribute I was referring to?
Ron Srebro
It refers to a property used to work out if two records are the same when synchronising data (e.g. between two Macs).
Amorya
A: 

The attribute which marks a property as an identity property in the modeling tool is in the Sync Services pane and is only used by Sync Services, not Core Data itself.

Jim Correia
Thanks Jim. Can you elaborate on that or point me to some documentation on the subject?
Ron Srebro
What additional clarification do you need? The settings in that panel are used only for Sync Services. The documentation <http://developer.apple.com/documentation/Cocoa/Conceptual/SyncServices/Articles/UsingCoreData.html#//apple_ref/doc/uid/TP40005232-SW7> mentions this. It is also covered in ISyncManager.h.
Jim Correia
Ron Srebro