English 中文(简体)
Limit the returned resultset in CoreData
原标题:

In CoreData, if I want to limit the returned resultset to 100, is it enough to just set the fetch limit to 100, or do I need to set the fetch batch size to 100 as well?

问题回答

It is enough to set the fetch limit to 100.

Setting the fetch batch size does something else entirely. Setting the fetch batch size to 100 (and the fetch limit to something bigger than 100) would let you retrieve more than 100 items, but only reading 100 of them into memory at a time. (The initial retrieval, which would fetch more than the 100 objects, fetches their ids, not the entire objects.) From the docs for -fetchBatchSize:

If you set a non-zero batch size, the collection of objects returned when the fetch is executed is broken into batches. 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.





相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。

热门标签