I created a blank SwiftUI project and included Core Data and Cloud Kit.
By selecting Core Data and CloudKit while creating the project, Apple already included some Core Data sample code and entities in the project, and also a Persistence.swift file that contained NSPersistentCloudKitContainer code.
The sample code included a SwiftUI list in ContentView, with an "Add" button to add timestamp to the list when pressing.
**I suppose after some basic setup to the project and created the CloudKit container, the app data will auto sync and can be viewed in CloudKit dashboard, but it didn't. **
Here is what I have setup:
- Created the project with Core Data and Cloud Kit
- Haven't touch any code from the Persistence.swift file since Apple has already set it up.
- Also haven't touch the app struct, content view and core data entities (left all sample code untouched)
- Selected Automatically Manage Signing and Development Team, with a paid developer acc.
- Added iCloud Capability
- Selected CloudKit in iCloud Capability, Created CloudKit Container.
- Added Background Modes Capability and selected Remote Notification.
And then:
- Launch simulator, launch app, being asked to sign in with Apple ID, and did so.
- Add some timestamps into SwiftUI list.
- Kill app and relaunch, the timestamps are still there, even del app and reinstall. Core Data sample code works perfectly.
- Went to the related container of CloudKit Dashboard, selected Records, Private Database, There are only "Users" in Record Type. No other record types were shown.
There are some log but is too long to post here, and this is the link: https://stackoverflow.com/questions/73841882/core-data-cloud-kit-data-record-type-does-not-appear-in-cloudkit-dashboard
Am I missing something?