How do i avoid running out of memory when performing a task on every item of core data?

后端 未结 2 1267
不知归路
不知归路 2021-01-29 03:32

I\'m trying to perform a task similar to this:

NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@\"Entry\"];

        NSPredicate *predicate          


        
2条回答
  •  闹比i
    闹比i (楼主)
    2021-01-29 04:14

    You guessed right. You have to use setFetchBatchSize:. This will only return the first 20 objects. If you want to get the next 20 objects, you have to set the offset using setFetchOffset:.

提交回复
热议问题