Batch size does not work when using parent/child contexts

后端 未结 2 1285
孤城傲影
孤城傲影 2020-12-05 05:56

I\'ve been able to confirm this on my application, and a quick sample application I created to confirm this. Here\'s the setup:

You have two managed object contexts:

2条回答
  •  情书的邮戳
    2020-12-05 06:50

    From NSFetchRequest Class Reference:

    When the fetch is executed, the entire request is evaluated and the identities of all matching objects recorded, but no more than batchSize objects’ data will be fetched from the persistent store at a time. The array returned from executing the request will be a proxy object that transparently faults batches on demand.

    So if the managed object context is not attached to a persistent store, there is nothing to fetch against - so the behavior you are seeing is at least somewhat consistent with the documentation. fetchLimit may work in the scenario you are describing. I would still fire a radar on it at bugreporter.apple.com .

提交回复
热议问题