Explore the details inside the synchronization of NSPersistentCloudKitContainer by capturing and analyzing a sysdiagnose. View Technote TN3163 >
Search results for
NSPersistentCloudKitContainer
589 results found
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I'm using Core Data and CloudKit together, and so far everything looks great. But one thing that I haven't been able to find much literature on is the interaction between NSPersistentCloudKitContainer and Persistent History Tracking. My assumption is that NSPersistentCloudKitContainer leans on Persistent History Tracking to execute its responsibilities. So if we're using Persistent History Tracking elsewhere – maybe to update an app extension using a process similar to the one outlined at https://www.avanderlee.com/swift/persistent-history-tracking-core-data/ – there's a risk of interrupting that process. Especially with regards to executing a NSPersistentHistoryChangeRequest.deleteHistory(before:) request. Would this run the risk of deleting history that NSPersistentCloudKitContainer requires to perform its roles? Is there a way to synchronise these various responsibilities?
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:
Is there a way to pause or disable syncing via NSPersistentCloudKitContainer at runtime? I want to give my users the option to enable or disable syncing, but there doesn't seem to be a good way to do it. I tried reloading the persistent stores and setting the store description's cloudKitContainerOptions to nil, but if I do that after first initialization, I get an error:error: Store opened without NSPersistentHistoryTrackingKey but previously had been opened with NSPersistentHistoryTrackingKey - Forcing into Read Only modeAnyone know of another way to do this?I submitted a request via Feedback Assistant for a flag to enable or disable syncing (FB6156182). I know the user could theoretically go into the Settings app and enable or disable iCloud access for the app as a whole, but that's not very discoverable, and disables all iCloud access. I'm looking for something a little more fine-grained (limited to the NSPersistentCloudKitContainer) and that I could control in my app's UI.
I want my exiting project that's using Core Data to enable it use NSPersistentCloudKitContainer.So I set up my project as below documentation Setting Up Core Data with CloudKit says.https://developer.apple.com/documentation/coredata/mirroring_a_core_data_store_with_cloudkit/setting_up_core_data_with_cloudkitBut if I change NSPersistentContainer into NSPersistentCloudKitContainer an error occures.The error message is Use of undeclared type 'NSPersistentCloudKitContainer'.Why this happen?Are there anyone who can solve this problem?Please help me.Thanks in advance.
I use NSPersistentCloudKitContainer to sync my apps data to iCloud. The app has a settings switch to enable or disable iCloud sync. As described in this thread, - https://developer.apple.com/forums/thread/118924 I set cloudKitContainerOptions to nil depending on the users setting. This is done before the persistent stores are loaded and works fine when the app is launched for the first time. My problem is that I don't know how to apply this settings change while NSPersistentCloudKitContainer is already loaded and active and its ManagedObjectContexts are in use? I could reload the entire container, but will that work while the app is still using contexts from the other container?
I have an app that uses NSPersistentCloudKitContainer to store all the data so it's backed by iCloud and synced between devices. Such app has a Share Extension, that can be triggered both from iOS (and iPadOS) and macOS (Catalyst). I was wondering if it's safe to instantiate an NSPersistentCloudKitContainer from a Share Extension due to it being very short lived. At the moment, I'm sending the data straight to iCloud instead of instantiating an NSPersistentCloudKitContainer, but it feels wrong because I'm using the keys that NSPersistentCloudKitContainer created internally (CD_MyEntity, CD_myProperty, etc.) to send it to iCloud and then being correctly pulled by my clients. The only concern that I have is that bringing up an NSPersistentCloudKitContainer that has to pull data, might delay or even loose the data that I'm saving right now because it gets killed after some amount of time since the share action has been completed. Any insights will be much appreciated,
I have been excited to add NSPersistentCloudKitContainer's share functionality to my app but I've noted a few thing I suspect are bugs: -When using share() on a NSManagedObject the share record is set up in a new zone. However, the root NSManagedObject's record is not being updated with the relationship linkage to the shared record. -Secondly, when you revoke a share, the cloudkit.share record is removed from iCloud, but not in the local data stores. This makes the fetchShares() method ineffective for detecting a missing cloudkit.share record. In order to re-share the root object the developer must call out to iCloud directly using the old methods to be sure if the share exists or not. I am using the code from Apple's 'Synchronizing a Local Store to the Cloud' sample. It would be nice if they added support for revoking shares into this sample and addressed these issues.
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags:
Cloud and Local Storage
UI Frameworks
wwdc21-10015
Hello all! I'm porting a ios15+ swiftui app to be compatible with Swift 6 and enabling strict concurrency checking gave me a warning that will be an error when switching to swift 6. I'm initializing a persistence controller for my cloud kit container: import CoreData struct PersistenceController { static let shared = PersistenceController() let container: NSPersistentCloudKitContainer init() { container = NSPersistentCloudKitContainer(name: IBreviary) container.loadPersistentStores(completionHandler: { _, error in if let error = error as NSError? { fatalError(Unresolved error (error), (error.userInfo)) } }) container.viewContext.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy container.viewContext.automaticallyMergesChangesFromParent = true } } The warning is on the merge policy: Reference to var 'NSMergeByPropertyObjectTrumpMergePolicy' is not concurrency-safe because it involves shared mutable state; this is an error in the Swift 6 language mode I have no idea how to make this concur
I see some sessions about using NSPersistentCloudKitContainer with the public CloudKit database, and it now accepts a ‘databaseScope’ property - can this be used with shared CloudKit databases?
Hi, I am developing sharing feature with already working mirroring and need to set parentRecord to child items. I want to extend NSPersistentCloudKitContainer (or any it's component used for mirroring) in some way to get access to CKRecords it is creating before container will push records to the server. Goal — I want to set CKRecord.parent right before CKModifyRecordsOperation fires somewhere in NSPersistentCloudKitContainer. Reason — NSPersistentCloudKitContainer do not handle parent records by itself.
Can I fire NSPersistentCloudKitContainer update manually? I want to schedule data sending event for server after unrestricting CloudKit restriction by CloudKit Web Service API.
I'm working on a SwiftUI app generating data using a standard CoreData data model and sync it with iCloud using NSPersistentCloudKitContainer. In this data model one parent is referencing on many children (e.g. > 2000 of children A and B). Each child A is also referencing onto one child B and vice versa: Parent ----> Child A; Parent ----> Child B; Child A <---> Child B The problem I am facing is, depending on the last time an CloudKit sync has been performed, the sync process takes hours to complete (where in the mean time the app might be sent to the background by the system or by the user and the sync is stopped). Is there a way to efficiently sync these larger datasets? Additionally I would like to pause the iCloud sync for specific occasions e.g. when performing continuous tasks using Background Modes and the app would be killed due to CPU pressure of iCloud sync. Is there a way to customize the syncing behavior of NSPersistentCloudKitContainer like e.g. CKOperation or by
I would need to access CKRecords of my NSManagedObjects on iOS 13.4 and there seems to be a documented method in NSPersistentCloudKitContainer, but the compiler can't see it! How this can be?Compilation error:https://vesacdn.s3.eu-north-1.amazonaws.com/compilation+error.pngClass definition seen by xcode 11.4.1:https://vesacdn.s3.eu-north-1.amazonaws.com/NSPersistentCloudKitContainer.pngDocumented:https://developer.apple.com/documentation/coredata/nspersistentcloudkitcontainer
Some of my users are experiencing synchronization issues when using the NSPersistentCloudKitContainer in CoreData. This error only occurs in Apple Watch so far. I can not find any documents about this error. Does anyone know what this error code means?