The session Using Core Data with CloudKit (https://developer.apple.com/videos/play/wwdc2019/202/) spoke of a sample app for demonstrating the new NSPersistentCloudKitContainer and how it ties Core Data and CloudKit together. I didn't see it listed with the session resources; has it been uploaded somewhere else? If not, when can we expect the sample application to be posted?
Search results for
NSPersistentCloudKitContainer
589 results found
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Once I have the path, I plan to do this.lazy var persistentContainer: NSPersistentCloudKitContainer = { let container = NSPersistentCloudKitContainer(name: “MyAppName”) // Create a store description for a CloudKit-backed local store let cloudStoreLocation = URL(fileURLWithPath: Original or Ubiquity Path) let cloudStoreDescription = NSPersistentStoreDescription(url: cloudStoreLocation) cloudStoreDescription.configuration = Cloud // Set the container options on the cloud store cloudStoreDescription.cloudKitContainerOptions = NSPersistentCloudKitContainerOptions( containerIdentifier: com.my.container) // Update the container's list of store descriptions container.persistentStoreDescriptions = [ cloudStoreDescription, ] // Load store container.loadPersistentStores { storeDescription, error in guard error == nil else { fatalError(Could not load persistent stores. (error!)) } } return container}()
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags:
Trying to set up a test app using NSPersistentCloudKitContainer. Once I got the container set up, got error that attributes must be Optional or provide a default value, which makes sense. Problem is I have one Entity that has a Binary Data field. The field has been marked as Optional.However, the DataModelCompile build step complains that Photo.image must have a default value Also get a CloudKit Integration error along the same lines: Photo.image must have a default value.But there is no way to define a default value for a Binary Data attribute, so don't see a way to fulfill this.Anybody got a clue or do you think its just something I should Radar?
NSPersistentCloudKitContainer only syncs to a private database, according to the published docs. No mention of public or shared CKDatabase.
Topic:
App & System Services
SubTopic:
Core OS
Tags:
It's not getting removed in iOS 13. In fact, much of the new NSPersistentCloudKitContainer workflow is based on persistent history tracking. See session WWDC 2019 session 202 Using Core Data With CloudKit and session 230 Making Apps with Core Data.
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags:
Hello I have this Core Data stack and I have an observer to observe NSPersistentStoreRemoteChange, I would like to filter changes that the user has made to call the mergePersistentHistoryChanges() just when needed, I think it has to be done in the fetchPersistentHistoryTransactionsAndChanges() function but I don't know how to do it. Can you help me. Thank You Here is my Core Data Stack: class PersistenceController { static let shared = PersistenceController() private var notificationToken: NSObjectProtocol? init() { notificationToken = NotificationCenter.default.addObserver(forName: .NSPersistentStoreRemoteChange, object: nil, queue: nil) { note in Task { await self.fetchPersistentHistory() } } } deinit { if let observer = notificationToken { NotificationCenter.default.removeObserver(observer) } } private var lastToken: NSPersistentHistoryToken? /// A persistent container to set up the Core Data stack. lazy var container: NSPersistentCloudKitContainer = { let fileContainer = URL.storeURL(for: group n
I keep getting the error below when connecting my app that uses a NSPersistentCloudKitContainer. I have made no changes to the code in months and I was working reliably. The error seems random and can sometime be resolved by disconnecting and re-connecting from wifi. It is not just my app but other apps that use CloudKit as well for synch. I know there were issues that were supposed to be fixed but this is happening every day now. Can anyone shed some light on this? [error] error: CoreData+CloudKit: -[PFCloudKitImporter databaseFetchFinishWithContext:error:completion:](249): : Database fetch for request: 58556A21-BDE3-49C6-A4E9-C1DAE2752629 failed with error:
Hi, I've set up NSPersistentCloudKitContainer with mirroring and it works well. I also managed how to create share for records. But how I can get shared record synced with my Core Data? Example: User A (owner) shared record with user B, how that record (with 1-to-many relationship) can be synchronised with user B Core Data?
Hi, I wrote an app that helps me count how many grams of protein I eat each day. I'm the only user now, and the app uses Core Data and the CloudKit container, to sync data across my devices. I was thinking about releasing it in App Store, and I noticed this in the app review guidelines: may not store personal health information in iCloud. Does that mean we cannot use Core Data with NSPersistentCloudKitContainer for an app like this? Thanks.
Hello. Now I'm trying to add Cloudkit + iCloud synchronization feature with NSPersistentCloudkitContainer. It's super easy and cool. However, When I tried some test with large data, there is expensive cost task on every app launch time. Actually, this task also executed on small dataset, but its cost increased by increasing local core data storage. This task seems like migration for cloudkit. I guess that this task save additional data on local storage. (I checked this on Settings > General > iPad Storage) This task takes 20 minutes (with 5GB test data, core data storage) on background thread , using full of one core cpu. Importantly, if there is new data to sync, the synchronization starts after this heavy migration task ends. So if user create new data and terminate application before migration ends, that new data never synchronized. Also, if I delete my cloud data on Settings > Account > iCloud > Manage Storgae, my local app storage remain some of data. My all local data to used on
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags:
CloudKit
Core Data
Cloud and Local Storage
I have a MOM that has multiple configurations. One configuration is for Core Data for CloudKit, and another is for a local store. There are no relationships between the entities in the local configration and the cloudkit configuration, so practically I could load my local store into a seperate NSPersistentContainer, if I moved my local configuration to a new MOM. However, is it possible to delay the loading of some stores in a MOM? The more I think about it, the less feasable it probably is. At present all stores are loaded into an NSPersistentCloudKitContainer in one shot, but I would like to just set the local store description on the container, and perform loadPersistentStores. Once my app is in a specific state, I would like to add the cloudkit store description to the container's list of persistent store descriptions and then call loadPersistentStores again, hoping that the container would load the cloudkit configuration's newly added store description, and not attempt to reload the local store.
What's the best way to handle errors that occur with CoreData-CloudKit mirroring? I'm specifically concerned about the quotaExceeded error, if the user has run out of free space. Don't see anything in the documentation or example project.
I am trying to get CoreData(Sync'd via NSPersistentCloudKitContainer, although that is not particularly relevant for the current issue) to play nicely (or even at all) with UICollectionViewDiffableDataSource. The stumbling block seems to be concerned with [NSManagedObject hash]. I need the diffing engine to notice a change when there is a change in the specific managedObject-subclass, AND/OR (at least some) of its child managedObject-subclasses. Example: So, in the above example object graph, I need the Posts datasource to notice when the 'name' of the Tag changes, and react accordingly. i.e. {Post.tags.any.name} The simplest solution would be if I could override[Post hash], but of course that's not allowed. Even obj-c method-swizzling does not work without complaining. Class 'Post' for entity 'Post' has an illegal override of NSManagedObject -hash Adding 'computed values' with the parent managed-object does not work; computed vars don't seem to be included in the [hash] implementation. Any ideas wha
Hello! I have a live app in the appstore which uses NSPersistentCloudKitContainer. When I was working on the app, whatever data was created while testing was reflecting in the Development section of the CloudKitDashboard. Then, when time came for releasing the app, I had pushed my schema to production and everything has been working well. Recently, I have been working to make some changes in my code and while testing I realised that that I am being pointed to Production. Now how do I move back to using Development while working on the app. I have tried changing values of in .entitlement file. But it still does not give me what I want. Below is my entitlement values: aps-environment development com.apple.developer.icloud-container-environment Development com.apple.developer.icloud-container-identifiers Does anyone have any suggestions?
I am trying to implement toggling iCloud sync in runtime for my App, i.e. when users toggle the switch in my app, a persistent container will be created according to sync on or off. it works when relaunching the app after changing the container, but how to do it in runtime? how to reload data from the new container and refresh into UIs which already contain the old data from the previous container? I searched all over the internet but could not find a solution to toggle iCloud sync in runtime properly. Below is the code from my core data stack: lazy var persistentContainer: NSPersistentContainer = { setupPersistentContainer() }() private func setupPersistentContainer() -> NSPersistentContainer { let isSyncOn = UserDefaults.standard.bool(forKey: isSyncOn) let container = isSyncOn ? NSPersistentCloudKitContainer(name: BaseTypes) : NSPersistentContainer(name: BaseTypes) guard let description = container.persistentStoreDescriptions.first else { fatalError(###(#function): Failed to retrieve a persisten