1

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?

4

1 回答 1

0

您是否使用来自 Sync Services 的任务实体的标准定义?苹果很好地定义了一个:

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

如果是这样,则存在三个身份属性(摘要、记录 ID 和日历)。

如果您要定义自己的实体(不与系统实体共享),您可以制作其他属性标识属性 - 我可能会选择“名称”和“到期日期”;您还可以添加“创建日期”以确保您能够真正创建一个唯一值来比较使用的记录。

然而,根据我的经验,同步服务在跟踪具有系统模式的身份属性的任务方面做得很好——我不记得上次看到重复任务来自我自己或用户的数据是什么时候了。

告诉我更多关于为什么您可能不想使用系统架构而是使用自己的架构 - 我可以考虑每种架构的优缺点。

于 2011-05-09T13:10:10.833 回答