Search code examples
iosswiftcore-datacloudkitnspersistentcloudkitcontainer

Is creationDate accessible through NSPersistentCloudKitContainer?


In the Cloudkit Dashboard, I can see a Created time for the record.

However, in my app when i use

NSSortDescriptor(key: "creationDate", ascending: false)

I get an error:

<NSSQLFetchRequestContext: 0x6000034d8c40> , keypath creationDate not found in entity <NSSQLEntity

I suspect I cannot access creationDate using NSPersistentCloudKitContainer?


Solution

  • You can't access creationDate from Core Data models, you can create your own creationDate field.

    If you want to access creation date you should use CloudKit methods for fetching records or NSPersistentCloudKitContainer record(for managedObjectID: NSManagedObjectID) method.