Retrieve Core Data Entities in Order of Insertion

后端 未结 2 851
情深已故
情深已故 2021-02-10 11:25

Is there an internal ID variable or timestamp I can use in a NSSortDescriptor to retrieve Core Data entities in the order they were inserted?

I would rather not have to

2条回答
  •  日久生厌
    2021-02-10 12:15

    No, if you want a sort order for your data, you need to add that to your entities yourself. However you can easily add a NSDate attribute that has a default value of "NOW" so that it will auto-populate.

提交回复
热议问题