Sign in
Log inSign up
Kris Slazinski

15 likes

·

1.4K reads

4 comments

Christopher Tibbs
Christopher Tibbs
Dec 20, 2023

Thanks a lot for taking the time to share this knowledge, Kris.

1
·
·1 reply
Kris Slazinski
Kris Slazinski
Author
·Dec 20, 2023

You’re welcome ☺️ I am happy that you found it useful.

·
Rodrigo Castillo
Rodrigo Castillo
Sep 18, 2024

Thank you very much for this code, I tried with ChatGPT and a YouTube video to create App Groups but only with you I could do the migration. The only problem, which is still small, is that the following line gave me an error because the database was not found:

init(inMemory: Bool = false) { container = NSPersistentCloudKitContainer(name: "iCloud.com.yourDomain.YourAppName’")

It should be only with the model name, ie: NSPersistentCloudKitContainer(name: "YourAppName’")

Rodrigo

1
·
·1 reply
Kris Slazinski
Kris Slazinski
Author
·Sep 19, 2024

Hi, Rodrigo. Thank you very much for your comment. I am glad to know that my article helped you 😊 As for the NSPersistentCloudKitContainer name... Did you maybe call your container using the "YourAppName" pattern? If so, yes, you need to use the same name in code. I have the following note in my article that explains more about the name of the container. Please let me know if it's still not clear and needs changes.

"We set our container as an NSPersistentCloudKitContainer with a name similar to "iCloud.com.yourDomain.YourAppName". One note here: while Apple suggests this naming convention, you can as well use a different one, for example, "iCloud.YourAppName". The most important thing is that this name must match the name of the iCloud container selected in the Signing & Capabilities tab of your app's target."

·