Identity Property in Sync Services

399 views Asked by At

can someone help me understand the identity property on an entity attribute? Im thinking of the identity property as a table "key" as in a Relational Database, but I'm guessing this is not it. Im using core data and in my entities I have not defined any "Key" columns, and all is working fine. But now that I have added sync services to my app, Im not sure how to use this sync attribute. My app is a task management planner, so I have an entity called task. I have an attribute called "name" , "due date" and other optional attributes. If I have 2 tasks with the same name, I want them both sync, so Im guessing the identity property wont do me good if I set it on the attribute "name". Right now I have not used it, and sync services is working fine... So my question is, in what other scenarios should I use the identity property?

1

There are 1 answers

1
Brian M. Criscuolo On

Are you using the standard definition of a task entity from Sync Services? Apple defined one fairly well:

http://developer.apple.com/library/mac/#documentation/AppleApplications/Reference/SyncServicesSchemaRef/Articles/Calendars.html

If so, there are three identity properties (summary, record id and calendar).

If you're defining your own entity (not sharing with the system entity) you can make additional attributes identity properties - I'd probably go with "name" and "due date" for sure; you could also add in a "created date" to ensure that you are able to truly create a unique value to compare records using.

In my experience, however, Sync Services has done a good job keeping track of tasks with the identity properties of the system's schema - I can't remember the last time I saw duplicate tasks coming through my own or user's data.

Tell me more about why you might not want to use the system schema but instead roll your own - I can think of pros and cons to each.