简体   繁体   中英

How do I sort CloudKit results by modified date?

I'm trying to order search results by the modified date. If I wanted to do by creationDate its:

query.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)]

What's the key for modified date? A list of all NSSortDescriptor keys or a way to find them would be extremely helpful.

Found it on accident after randomly trying 100 things. It's:

query.sortDescriptors = [NSSortDescriptor(key: "modificationDate", ascending: false)]

They key being "modificationDate" I could still use a list of these a info on how to find them. -Thanks

You can simply look at the CKRecord keys (metadata) on the Apple website here; https://developer.apple.com/reference/cloudkit/ckrecord

This is in answer to your last question.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM