简体   繁体   中英

How to filter Core Data managed objects by NSPredicate?

I need to filter the managed objects in the Core Data by NSPredicate. I tried two methods as below to do the filtering task.

  • applying NSPredicate during the fetch request process.

  • using NSPredicate in the array of all managed objects which provided by the fetch result controller.

Which method is more efficient?

Thanks

Using the NSPredicate on the fetch request would be more memory efficient I would imagine, since those objects are never loaded into memory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM