I am using Xamarin in C# to get records saved in CloudKit private storage, in time order. It's possible for me to get records without sorting:
var predicate = NSPredicate.FromValue(true);
var query = new CKQuery(nameof(EventName), predicate); // all records
/*
var sort = new NSSortDescriptor("createdAt", false); // false or true don't matter. no records found
query.SortDescriptors = new NSSortDescriptor[] { sort }; // no result
*/
CKRecord[] records = await Container.PrivateCloudDatabase.PerformQueryAsync(query, null);
I have set the createdAt
field in the CloudKit Dashboard in the developer portal to Queryable
, as mentioned in this thread: CloudKit: Order query results by creation date. But using the NSSortDescriptor
prevents any records to be returned.