CloudKit With CoreData Not Working in Production
This question bothered me a lot when I first started to use CoreData + CloudKit.
The sync between local and cloud database worked perfectly while developing but as soon as the app was published to the AppStore, it stopped working.
Here you can read my guide on how to use CoreData with SwiftUI.
Well the answer is pretty simple:
Your CloudKit scheme has to be deployed to production.
And every time you add or change your data models, you have to deploy it to production, so CloudKit knows what your data structure looks like and it will sync with CoreData.
- Go to the CloudKit console and then select CloudKit Database
- Select your container from the dropdown in the top-left corner
- Make sure your in the Development environment
- In the left sidebar, select Deploy Schema Changes…
- Verify the changes are correct
- Tap Deploy
This is a really simple step but it can be overlooked and it drove me crazy, trying to figuring out what was the problem.
I hope this will resolve your issue.
What are you thoughts about this? Tweet me @franceleonidev and share your opinion.
- Mobile App Development (616)