I would like to implement notifications about NSPersistentCloudKitContainer I find this classe but I receive no notifications in my app!?! Do I need more settings to use it? thanx for your help import Combine import CoreData @available(iOS 14.0, *) class SyncMonitor { /// Where we store Combine cancellables for publishers we're listening to, e.g. NSPersistentCloudKitContainer's notifications. fileprivate var disposables = Set() init() { NotificationCenter.default.publisher(for: NSPersistentCloudKitContainer.eventChangedNotification) .sink(receiveValue: { notification in if let cloudEvent = notification.userInfo?[NSPersistentCloudKitContainer.eventNotificationUserInfoKey] as? NSPersistentCloudKitContainer.Event { // NSPersistentCloudKitContainer sends a notification when an event starts, and another when it // ends. If it has an endDate, it means the event finished. if cloudEvent.endDate == nil { print(Starting an event...) // You could check the type, but I'm trying to keep this bri
Search results for
NSPersistentCloudKitContainer
589 results found
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
We're receiving crash reports where our app is killed by the system because of 0xdead10cc. If I understand correctly this is happening because our app has a file lock or SQLite database lock. Our app is using NSPersistentCloudKitContainer and is indexing the data to Core Spotlight. In my naiveté I assumed that NSPersistentCloudKitContainer and Core Spotlight would release any locks when app is suspended. What is the best way to solve this? Asking for more background time doesn't feel like a solution, that will just postpone the crash.
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags:
CloudKit
Core Data
Core Spotlight
Background Tasks
Does anyone know if the new NSPersistentCloudKitContainer will work in an Application that shares data with others (CKShare), or will it only work as shown in the demo with other devices of the same iCloud Account?
Hello,I've tried to figure this out for weeks now, but can't find a solution. I am not very experienced in App Development yet, so maybe it can be solved with little effort and I just don't know how...?I am working on a baby journal app where parents should be able to share a child record together with all its entries (existing ones and ones that are going to be added in the future) to be able to both edit and add and look at entries. So, I need sharing like in the Apple Notes App.I am using core data and the new NSPersistentCloudKitContainer. The core data model consists of a child record and entities that are referencing to the child.I know that at the moment NSPersistentCloudkitContainer doesn't support sharing.I have no clue how to add sharing with CKShare API beside the core data stuff. To have a proper solution, do I need toa) throw away NSPersistentCloudKitContainer and solely base the app on CloudKit API with no core data at all?b) add CloudKit Sharing via CKShare API, exist
Is there any way to force NSPersistentCloudKitContainer to do a full sync?
Given the current quarantine and self isolation around the world, I was wondering if NSPersistentCloudKitContainer can be shared between users for collaborative work - pretty much like Pages or Keynote. I am aware of the new .public database scope, but this would rather be private with specific access by invitation. Is anyone aware of how to implement that?
Hello,I'm working on refactoring an existing app to use the new NSPersistentCloudKitContainer.Our app is managing different Projects items which consist of a mix of structured data and files.Files are stored locally and only their path are stored in one core data store at the moment.Enabling NSPersistentCloudKitContainer did the job as now the db syncs between devices as expected.As we would like to segregate each project into its own CoreData store, my question is: Is it possible to leverage NSPersistentCloudKitContainer to sync multiple core data stores within the same app and have all of those stores synced?Can you point me to any documentation that demonstrate this use case?Thanks for the feedback.Best regardsSantiago
Hello,I ported the WWDC 2019 NSPersistentCloudKitContainer demo project to Mac Catalyst and it keeps on crashing everytime I run (within a minute or so of the app running). I'm getting the same BAD EXC INSTRUCTION on my Mac Catalyst app as well (which uses NSPersistentCloudKitContainer). Both projects run just fine on iPad and iPhone.Anybody experiencing the same issue? Any help would be appreciated.
I use NSPersistentCloudKitContainer to synchronize data between iOS and macOS. After installing the app, it takes long (sometimes up to an hour) for all data to become available. Related to this, I have a few questions: Synchronization seems only to take place when the app runs in the foreground. Is there a way to keep the app synchronizing when it is brought to the background? I have enabled remote notifications and use registerForRemoteNotifications in my app delegate (via UIApplicationDelegateAdaptor). I haven't yet experimented with background processing. Should I do that, and can you point me to some references? Is there a way to check whether the local-stored data matches what's available on the server? E.g. checking whether a (local-stored) NSPersistentHistoryToken matches the latest NSPersistentHistoryToken on the server. Internally NSPersistentCloudKitContainer knows, as I can see log events popping up saying that there are no new data to mirror. I would like to know this to inform
Hi, does someone knows about the bug, that the NSPersistentCloudKitContainer doesn't return CKShares at the first time? Is this an intended behavior? My current fix: let container: NSPersistentCloudKitContainer = .... // Fix begin let managedObject = .... // Object which is in a share let record = container.record(for: managedObject.objectID) // Fix end let shares = (try? container.fetchShares(in: nil)) ?? [] If I execute exactly the same code without the fix that I fetch the record first, then it returns 0 shares. With the fix it is currently 9 shares (the actual count of the shares). Another fix: let container: NSPersistentCloudKitContainer = .... // Fix begin let _ = try? container.fetchShares(in: nil) Thread.sleep(forTimeInterval: 0.1) // Fix end let shares = (try? container.fetchShares(in: nil)) ?? [] For that fix it also returns at the second time the expected count of shares. But without the delay it returns also at the second time zero shares. Anyone had the same problem and
After many months/years of trying to create my own CoreData/iCloud sync engine, and getting about 90% of the way there; I gave up and started using NSPersistentCloudKitContainer, forcing us to drop support for iOS 12-. At first all seemed fine, however, today it all went horribly wrong (still investigating why) I now have 'duplicate' CKRecords of single ManagedObjects in CloudKit, and (it seems, although still tracking down the model) disconnected 'references'. Having looked at CloudKit Dashboard is seems that NSPersistentCloudKitContainer does not use ANY references, but simply a String of the UUID of the referenced CKRecord. I can only presume that this is a workaround to prevent Referencing a (not yet) non-existent CKRecord. So, this presents several questions: Is the lack of CKReference by design, or a bug? What defensive programming is in place to prevent duplications or corrupt references when using Stringly-Typed pseudo-references? Is there a way to inform the NSPersistentCloudKitContainer
Identify and resolve synchronization issues when working with NSPersistentCloudKitContainer. View Technote TN3164 >
I have a single multiplatform application that I use NSPersistentCloudKitContainer on. This works great, except I noticed when I open two instances of the same process (not windows) on the same computer, which share the same store, data duplication and Metadata Inconsistency errors start appearing. This answer (https://stackoverflow.com/a/67243833) says this is not supported with NSPersistentCloudKitContainer. Is this indeed true? If it isn't allowed, is the only solution to disable multiple instances of the process via a lock file? I was thinking one could somehow coordinate a single leader process that syncs to the cloud, with the others using NSPersistentContainer, but this would be complicated when the leader process terminates. Currently, it seems iPad split views are new windows, not processes -- but overall I'm still curious :0 Thank you!
The Apple Demo, which is very thorough, doesn't prune persistent history?And the Forum Thread seems to suggest that persistent history is integral to how NSPersistentCloudKitContainer works.Are we supposed to explicitly prune persistent history ourselves or is it handled for us by NSPersistentCloudKitContainer?Apple Demo: https://developer.apple.com/documentation/coredata/synchronizing_a_local_store_to_the_cloudForum Thread: https://forums.developer.apple.com/message/373336#373336
Explore the details inside the synchronization of NSPersistentCloudKitContainer by capturing and analyzing a sysdiagnose. View Technote TN3163 >