How to query by creationDate in CloudKit?

喜夏-厌秋 提交于 2019-11-30 11:45:18
Gomfucius

Found out my own question. You'll need to log in to CloudKit dashboard and have this checkmark box checked.

Once it's checked, you'll be able to query by date like so:

let date = NSDate(timeInterval: -60.0 * 120, sinceDate: NSDate())
let predicate = NSPredicate(format: "creationDate > %@", date)

Here's more detailed document of what kind of NSPredicate you can use for CloudKit: https://developer.apple.com/documentation/cloudkit/ckquery#//apple_ref/doc/uid/TP40014043-CH1-SW8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!