/ Returns a URL for the given app group and database pointing to the sqlite database. PersistentContainer.persistentStoreDescriptions = įor this, we’re making use of a handy URL extension to get the path to the shared container using the security application group identifier. Let storeDescription = NSPersistentStoreDescription(url: storeURL) Let storeURL = URL.storeURL(for: "", databaseName: "Coyote") Let persistentContainer = NSPersistentContainer(name: "Collect") You basically save your database into the shared App Container. You can do this by logging into your account at :Īdding the App Group to your App IdentifierĪfter that, you can update your persistent store description. Note that the App Group is turned into red when you didn’t add it to your App Identifier yet. This will eventually result in the following overview of app groups for your project:Īn overview of the app groups for your project We can do this by adding an app group capability within your projects “Signing & Capabilities” section:Īdding an app group to your project for Core Data sharing It should be providing some type of URL or something along those lines. For example if I go to in Google Chrome and use my share extension it just provides Apple as a string to my extension which my app doesn't really support. To share data we need to create a shared container between the main app and its extensions. If I add then the share extension appears in the apps listed above but just returns a string to my extension. Web URL Quickly copy or open the corresponding HTTP URLs of a. ![]() Setting up the Persistent Container for data sharing Connect to Rackspace Cloudfiles or any other OpenStack Swift cloud storage. Luckily enough, Apple made it easy to share a persistent container with your extensions. The app extension and containing app have no direct access to each other’s container, even though an app extension bundle is nested within its containing app’s bundle. Within the Collect App, we have a Share extension and an Action extension that both require the use of the same underlying persistent container. Sharing your Core Data database with your Today extension, Action extension or Share extension is something quite common if you’re using Core Data as your database solution. You can read more about it in my blog post Persistent History Tracking in Core Data. ![]() Starting from iOS 13 I recommend Persistent History Tracking as a solution to sharing a single database. Share extension: Appears as an icon in the iOS share sheet, and when selected opens a Drafts window with options to edit/adjust the text, assign tags/flags, and. Try it today! Sharing the same Core Data persistent container with App Extensions Get more from your QA process Waldo automates the capture of quality debugging information for iOS developers during the QA process, so you don’t have to rely on a vague bug report to address issues in your build.
0 Comments
Leave a Reply. |