Search results for

NSPersistentCloudKitContainer

589 results found

Post

Replies

Boosts

Views

Activity

Posts Sample Application for 'Using Core Data with CloudKit'
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?
2
0
2.2k
Jun ’19
Reply to Questions About Updating Older Core Data / iCloud App to Core Data / CloudKit
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}()
Jun ’19
App with NSPersistentCloudKitContainer & Binary Data Attribute can't build
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?
2
0
2.1k
Jun ’19
Filter store transactions Core Data
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
0
0
968
Jan ’22
CloudKit NSPersistentCloudKitContainer error
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:
0
0
702
Apr ’22
Health data like daily grams of protein in Core Data CloudKit container?
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.
0
0
395
Jul ’20
NSPersistentCloudkitContainer makes Cloudkit Metadata Migrator
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
0
0
763
Jul ’20
Can you call loadPersistentStores multiple times?
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.
0
0
688
Aug ’19
How can I get NSPersistentCloudKitContainer working with UICollectionViewDiffableDataSource
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
0
0
813
Jun ’21
Switching from production to development database
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?
0
0
489
Jun ’21
How to enable/disable cloudkit in runtime.
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
0
0
1.1k
Oct ’22