Core Data Primary Key

前端 未结 7 783
無奈伤痛
無奈伤痛 2020-11-28 02:37

This may seem stupid, but I still couldn\'t figure out how to mark a attribute as a primary key in the xcdatamodel file. My persistent storage is sqlite file. Can anyone hel

7条回答
  •  盖世英雄少女心
    2020-11-28 02:56

    Core Data makes its own primary key - you don't have to add one. You can retrieve it with

    NSManagedObjectID *moID = [managedObject objectID];
    

提交回复
热议问题