CloudKit 批量获取? [英] CloudKit Batch Fetches?

查看:22
本文介绍了CloudKit 批量获取?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 CloudKit,如何批量获取结果?

Using CloudKit, how can I fetch my results in batches?

我知道默认提取限制它 100 个结果.那么我该拿谁来获取后续的 100 个结果呢?

I know that the default fetch limit it 100 results. So who do I then fetch the subsequent 100 results?

推荐答案

CloudKit 返回的记录数不固定.CloudKit 有一种机制来决定返回多少记录.看起来它目前是 100,但它可能会根据 Cloudkit 上的当前负载而改变.可以在 CKQueryOperation 对象上将其设置为固定数字.默认为:

The number of records returned by CloudKit is not fixed. CloudKit has a mechanism for deciding how many records to return. It looks like it's currently 100, but it could change depending on the current load on Cloudkit. It is possible to set this to a fixed number on the CKQueryOperation object. The default is:

operation.resultsLimit = CKQueryOperationMaximumResults;

该属性的文档说:使用该值时,服务器会选择一个限制,旨在提供最佳数量的结果,返回尽可能多的记录,同时最大限度地减少接收这些记录的延迟.但是,如果您知道要处理固定数量的结果,请相应地更改此属性的值.

CKQueryOperation 将在 queryCompletionBlock 中返回一个游标,然后可以使用该游标执行另一个 CKQueryOperation 以获取下一个块.

The CKQueryOperation will return a cursor in the queryCompletionBlock which can then be used to execute an other CKQueryOperation to fetch the next block.

这篇关于CloudKit 批量获取?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆