使用CloudKit,我如何批量获取结果?
我知道默认的提取限制为100的结果。那么我该如何获取随后的100个结果?
感谢。
答案 0 :(得分:2)
CloudKit返回的记录数量不固定。 CloudKit有一种机制来决定返回多少记录。它看起来像是100,但它可能会根据Cloudkit上的当前负载而改变。可以在CKQueryOperation对象上将其设置为固定数字。默认值为:
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以获取下一个块。