iPhone OS: Fetching a random entity instance using NSPredicate Nsfetchrequest and core data
Posted
by nickthedude
on Stack Overflow
See other posts from Stack Overflow
or by nickthedude
Published on 2010-05-13T21:42:42Z
Indexed on
2010/05/13
21:44 UTC
Read the original article
Hit count: 443
Working on an app where I have a large collections of managed objects against which I want to fetch a few random instances.
My question is, is there any way I can use NSPredicate and NSFetchRequest to return several objects at random.
I saw that you could actually add a NSFetchRequest into the entity using the data modeler, any way to do the random fetch using this?
Also what would be the best method for determining the "count" of a table so I can set the bounds of the random number generator.
let me know if you need more details.
Thanks!
Nick
© Stack Overflow or respective owner