iPhone Development - Using NSPredicate to retrieve most recently added record from CoreData
Posted
by Mustafa
on Stack Overflow
See other posts from Stack Overflow
or by Mustafa
Published on 2010-04-06T05:20:29Z
Indexed on
2010/04/06
5:23 UTC
Read the original article
Hit count: 297
I want to retrieve the most recently added record from CoreData. I was wondering if that's possible using NSPredicate? If so, how?
e.g. i have a one-to-many relationship between Department and Staff, and i want to fetch the Staff record that was most recently employed. The Staff table has a date field which can be used.
I don't want to fetch all the Staff records and then look for the right one. Note that CoreData stores the related records in an NSSet.
© Stack Overflow or respective owner