Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App Groups and iCloud in iOS

I am familiar with iCloud syncing, but I am new to app groups. There may be a simple answer to this question, but I haven't found it yet. Basically, I have an app in which I have iCloud integration, and now I want to try to add a today extension. I am currently using Core Data as a backend and would like to continue to do so. However, from what I have read, I need to move my data store to a shared location by defining an "App Group". (http://blog.sam-oakley.co.uk/post/92323630293/sharing-core-data-between-app-and-extension-in-ios-8 and Accessing Core Data SQL Database in iOS 8 Extension (Sharing Data Between App and Widget Extension)) I haven't been able to find out if this location is synced using iCloud or not. Or, because I"m using iCloud, do I need an App Group at all? I appreciate any and all help/suggestions.

like image 600
James Avatar asked Mar 17 '23 19:03

James


1 Answers

If you're already using iCloud, you don't need to use app groups, because your extension can access the same iCloud container as your app does. As long as your entitlements and provisioning are configured correctly, you can literally just use the same Core Data stack setup in the extension as in the app.

Apple's Lister demo project does this, but there's nothing special about it. Just use iCloud as usual.

App groups are usually necessary to share data between apps and extensions. But a big exception is when the data is already stored external to the app-- as with iCloud.

like image 137
Tom Harrington Avatar answered Apr 08 '23 19:04

Tom Harrington