CKLocationSortDescriptor 无效

CKLocationSortDescriptor having no effect

使用 CKLocationSortDescriptor 传递我的 CloudKit 查询,但没有任何效果。它显示在一个 tableview 上,它是按照离用户最近的顺序和距离升序排列的。

...

let location = locationManager.location
let predicate = NSPredicate(value: true)
let query = CKQuery(recordType: "Establishment", predicate: predicate)
let sort = CKLocationSortDescriptor(key: "Location", relativeLocation: location!)

query.sortDescriptors = [CKLocationSortDescriptor(key: "Location", relativeLocation: location!)]

...

编辑 1

在弄乱了这个之后,据我所知,它不会对 2 公里内的任何东西进行排序,再靠近它就会恢复到上次编辑的状态。任何想法如何使它更准确,因为我希望以一米的精度做到这一点?

我使用了 TSI 并联系了 Apple。事实证明,CKLocationSortDescriptor 仅精确到 10 公里,这显然不是错误,实际上是他们忘记添加到文档中的内容。 Cloudkit 团队正在努力改进这一点,但无法给出时间表。如果您想订购 10 公里以内的任何商品,目前无法订购。