ios - NSPredicate for NSFetchedResultsController when searching a relationship -


i working nsfetchedresultscontroller. want display in table view lions in zoo, lions to-many relationship of zoo. there thousands of lions, need batch size of 20.

nsfetchrequest* fetchrequest = [[nsfetchrequest alloc] init];         nspredicate* predicate = ???          nsentitydescription* entity = [nsentitydescription entityforname:@"lion" inmanagedobjectcontext:context];         [fetchrequest setentity:entity];         [fetchrequest setpredicate:predicate];          [fetchrequest setfetchbatchsize:20]; 

how set predicate? have zoo object. need lions.

as know nspredicate class specifies how data should fetched or filtered.

nsfetchrequest has predicate property, specifies logical conditions under managed objects should retrieved.

here's great example on how can use core data - http://nshipster.com/nspredicate/


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -