且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

swift:获取最近存储在核心数据中的日期

更新时间:2023-02-16 11:24:57

正如你提到的使用Core Data,正确的方向是获取这个对象(联系人)。然后你将有一个NSManagedObjects数组。如果fecth成功,你在一个'for in'循环中迭代它们。
在这个循环中使用'.valueForKey'提取日期并应用你创建的规则,返回你想要的NsManagedObject或者属性。

As you mentioned using Core Data, the right direction is to Fetch this objects (the contacts). Then you will have an Array of NSManagedObjects. If the fecth is successful you iterate them in a ´for in´ loop. Inside this loop use ´.valueForKey´ to extract the dates and apply the rules you have created, returning the NsManagedObject or Atribute you want.