开发者

setFetchBatchSize on a NSFetchRequest on the iPhone

I don't understand the meaning of开发者_JAVA技巧 setFetchBatchSize.

In the following code, I set the fetch batch size to 20, but I still get 49 objects in my results array (which are ALL the objects from the query)

        NSPredicate *predicate = [NSPredicate predicateWithFormat:@"company.id = %@", company.id];
        NSFetchRequest *req = [CategoryEntity requestAllSortedBy:@"id" ascending:YES withPredicate:predicate];
        [req setFetchBatchSize:20];
        NSArray *results = [CategoryEntity executeFetchRequest:req];

So what's the meaning of setFetchBatchSize, since it doesn't seem to limit the request?


To limit the size use fetchLimit.

With batch size, the objects are faulted. They look like they are there but those are just stubs. When you access them - behind the scenes - the values are then populated.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜