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

查看:84
本文介绍了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;

此属性的文档说:When using that value, the server chooses a limit that aims to provide an optimal number of results that returns as many records as possible while minimizing delays in receiving those records. However, if you know that you want to process a fixed number of results, change the value of this property accordingly.

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天全站免登陆