如何使用CloudKit框架限制返回记录数?

How to limit the number of returned records using CloudKit framework?

有什么方法可以限制 return 使用 CloudKit 框架从查询中编辑的记录数?例如。只有 return 按日期排序的最新值(已经弄清楚了)然后将 returned 记录限制为 1?

是的,使用 CKQueryOperation and it's resultsLimit 属性.

resultsLimit

The maximum number of records to return at one time.

Discussion

For most queries, leave the value of this property as the default value, which is the maximumResults constant. When using that value, CloudKit returns as many records as possible while minimizing delays in receiving those records. If you want to process a fixed number of results, change the value of this property accordingly.