按插入顺序检索核心数据实体 [英] Retrieve Core Data Entities in Order of Insertion

查看:133
本文介绍了按插入顺序检索核心数据实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有内部ID变量或时间戳我可以在NSSortDescriptor中使用它们按照它们插入的顺序检索Core Data实体?

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?

我宁愿不必

推荐答案

不,如果没有其他替代方法,你想要一个排序顺序的数据,你需要自己添加到你的实体。但是,您可以轻松添加一个默认值为NOW的NSDate属性,以便它将自动填充。

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.

这篇关于按插入顺序检索核心数据实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆