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
Search results for
NSPersistentCloudKitContainer
589 results found
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
I have an app that uses NSPersistentCloudKitContainer to synchronise data with iCloud. Users reported occasional data loss after which I started debugging my implementation.Part of my app’s implementation is showing a pop-up that displays information and has a confirm button. When the user clicks this button, one or more instances of a custom NSManagedObject subclass gets modified.At the same time, NSPersistentCloudKitContainer triggers a mirror process when the app resigns and becomes active. This happens when the user clicks the above mentioned confirm button. It does this by executing a NSCloudKitMirroringExportRequest and NSCloudKitMirroringImportRequest request.In other words, in my app, data gets modified (explicitly via code) and gets mirrored (implicitly via CloudKit) at the same time, and this is where things go wrong.Essentially this is what happens:1. A property (NSTimeInterval) of an instance of an NSManagedObject subclass gets incremented (e.g. 0 + 1 = 1).2. NSPersistentCloudKitContainer
Hello, I am using NSPersistentCloudKitContainer to share data between iOS and macOS app.I have set up the project according to the official tutorials. And when I made changes from the macOS app, the lastest data will automatically display on my iOS app. But in the other direction when I made changes on iOS, macOS app will not get the lastest version of the data.I have verified on Cloud Dashboard that the changes made on iOS have been uploaded onto CloudKit server. Just the macOS app and the cloudd process won't create tasks to pull these changes (observed from console.app). And if I quit the macOS app and restart it, lastest data will be pulled.So the problem is that macOS using NSPersistentCloudKitContainer will not get synced data in the runtime.One potential reason is that the official tutorial has mentioned to set the background Remote Notification. I've done this for the iOS app. But for the macOS app, there are no background mode options so I skipped this step.Any ideas to get the sync
I'm attempting to create a Swift/SwiftUI app that will run on iOS/iPadOS that uses CloudKit to syncronize data between devices. I have created the App in Xcode.In the Apps Signing & Capabilities tab, I have:- Ensured that the Bundle Identifier is valid- Added the iCloud capability - Created the Container and checked it - Validated that the Container was created in the CloudKit Dashbaord- Added the Backgrouind Modes capability - Checked the Remote notifications optionI have modified/validated AppDelegate.swift:- Validated that it is using NSPersistentCloudKitContainer- Added container.viewContext.automaticallyMergesChangesFromParent to true- Added container.viewContext.mergePolicy to NSMergeByPropertyObjectTrumpMergePolicyWhen I load the App, I get a series of errors reported related to CloudKit NSCloudKitMirroringExportRequest. These errors are shown below. I am able to create records, but can see they are only stored locally and do not get synced to the CloudKit Dashboard - interestingly enough,
I have exactly the same problem, I use NSPersistentCloudKitContainer with Catalyst. The problem started after I deployed the Schema to production.The synchronization works perfectly on all devices (mac, iPhone, Simulator) until I add a photo from Simulator. This photo is synchronized with Mac, but as soon as it tries to sync with iPhone, it crashes. The only way I found not to crash, is to delete as many photos as I had added from Simulator. After that, iPhone crashes stops and starts syncing again.EDIT:I've found that the problem is not from the simulator but from a big image.I tried that using a 8k image and it crashed.If I deselect the Allow External Storage option though, it works fine.
Topic:
App & System Services
SubTopic:
Core OS
Tags:
I am using NSPersistentCloudKitContainer. All data sync in iCloud. And when uninstalled the app, its sync correctly. However, it's required to encrypt sensitive data. I made my password attribute Transformable. Thus work fine locally. However when I delete the app. Install again. All other attributes(String, Int) sync correctly but transformable attribute does not export/synced.Here is my Modelhttps://i.stack.imgur.com/emA4m.pngpublic class EmployeeEntity: NSManagedObject { @NSManaged public var password: NSObject? @NSManaged public var firstName: String? @NSManaged public var lastName: String? @NSManaged public var idNumber: String? @NSManaged public var modifiedDate: Date? @NSManaged public var password: String? @NSManaged public var title: String? static var entityName: String { return EmployeeEntity }}extension EmployeeEntity { static func getListItemFetchRequest() -> NSFetchRequest<EmployeeEntity>{ let request = EmployeeEntity.fetchRequest() as! NSFetchRequest<EmployeeEntity> requ
For the past two days I've been trying to figure out how to get the notification when the iCloud data has changed. I use a NSPersistentCloudKitContainer and am able to see my changes from one device in another. I just added local notifications to my app and I save the notification to an iCloud entity whenever a user sets it.Since I'm adding this notification in iCloud, a remote notification with iCloud changes will be sent to the users devices with iCloud enabled. What I would like to do is when the device gets this notification, read from the new data and set a local notification on the current device if a notification entity is found.But I can not seem to figure out how to intercept this change notification. I tried using didReceive and didReceiveRemoteNotification from the AppDelegate, but none of these functions fired when the device received the iCloud changes. In the Xcode console I can see that the device is notified with the data.How can I intercept the background notification that contains t
I have this problem where your crash originates on the queue:com.apple.xpc.activity.com.apple.cloudkit.scheduler.com.apple.coredata.cloudkit.activity.export (serial)This might be the same problem you are speaking of.I reported it to Apple (no solution yet).But important point is: It seems to happen only in debug mode. I have released an app with NSPersistentCloudKitContainer and it does not crash in production.
Topic:
App & System Services
SubTopic:
General
Tags:
Let's suppose I want to provide a new user with some sample data which they can use to familiarize themselves with my app. In the NSPersistentContainer (i.e., local-only) case, I use one-time initialization logic to manually populate my app with this sample data. Then, over time, the user can keep that data, modify it, or delete it, as they choose.Now if I want to do the same thing with NSPersistentCloudKitContainer, this should be fine with my user's first device. But let's further suppose that (after using my app [and changing the CoreData database contents), my user load my app on a second device and runs it. On the second device, it will ALSO build an initial database containing sample data.What happens now? Does the content of the second device superceed the contents of the first? Suppose the user deleted a same record on device 1, but that sample record is loaded onto device 2 (as part of it's one-time initialization). Does that record reappear on device 1? And if a sample record is modified on
So I believe I am overthinking it!lazy var persistentContainer: NSPersistentCloudKitContainer = { let container = NSPersistentCloudKitContainer(name: Model) let storeLocation = URL(fileURLWithPath: /path/to/cloud.store) let storeDescription = NSPersistentStoreDescription(url: storeLocation) //Set the container options cloudStoreDescription.cloudKitContainerOptions = NSPersistentCloudKitContainerOptions(containerIdentifier: com.myCompany.myApp2) // TODO: Migrate Core Data Store to new Model Version container.loadPersitentStores... ... }()This should be enough to handle the migration from Container 1 to 2, since the data is already stored in Core Data. Then instead of hooking up a persistent container to the old CloudKit container (which would probably throw errors due to mismatched Schema), we can use CloudKit to fetch and confirm all data has already transfered properly, fix missing data, and delete the recrods in Container 1.I decided not to Migrate Containers for this, instead Im using ver
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags:
I have a model that has already been pushed to production, and I would like to move an attribute to a new entity as a relationship.From This:extension Note { @NSManaged public var drawingData: Data? .... }To This: extension Note { @NSManaged public var drawing: Drawing? .... } extension Drawing { @NSManaged public var drawingData: Data? .... }According to the Apple Docs under the Update your Production Schema section, I will need to migrate to a new CloudKit Container, since we can't delete attributes on production CKRecords.What is the proper workflow to do this?I have come up with the following, but I believe it is wrong.lazy var oldPersistentContainer: NSPersistentCloudKitContainer = { let container = NSPersistentCloudKitContainer(name: Model) let storeLocation = URL(fileURLWithPath: /path/to/cloud.store) let storeDescription = NSPersistentStoreDescription(url: storeLocation) // Set the container options on the cloud store cloudStoreDescription.cloudKitContainerOptions = NSPersistentCloud
Hello,I have an issue in an app which is yet unreleased.The app uses Core Data, and I recently added CloudKit integration.Whenever I start the app data get automatically downloaded by CloudKit and I get this log: <NSCloudKitMirroringDelegate: 0x600001da61b0> - Never successfully initialized and cannot execute request '<NSCloudKitMirroringImportRequest: 0x6000024c88a0> D3FB21AB-94ED-40B7-859B-6CBEE6149473' due to error: Error Domain=NSCocoaErrorDomain Code=134404 (null) UserInfo={NSDetailedErrors=( Error Domain=NSCocoaErrorDomain Code=133021 (null) UserInfo={NSExceptionOmitCallstacks=true, conflictList=(n NSConstraintConflict (0x600003f40e00) for constraint (n namen): database: 0x8143748c0004e8e1 <x-coredata://272191BB-7D10-41DD-8E4B-56F4ECE4AB9F/Ingredient/p195>, conflictedObjects: (n 0x8143748c181ce8e1 <x-coredata://272191BB-7D10-41DD-8E4B-56F4ECE4AB9F/Ingredient/p1733>n),n NSConstraintConflict (0x600003f42fc0) for constraint (n namen): database: 0x8143748c029ce8e1 <x-coredata://27
I'm trying to call CKFetchRecordZoneChangesOperation to get the latest changes from the shared database.But when I run that operation from inside didFinishLaunchingWithOptions, NSPersistentCloudKitContainer will break. It will save to coredata, but it will no longer sync to Cloudkit. It's as if it's paused. When I restart the app, the sync resumes.But if I call CKFetchRecordZoneChangesOperation later in the app lifecycle, say in viewDidLoad, everything works fine. Why is this?
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
Oh cool, I guess cmd+s is post....2) I'm curious if there's a means to allow the user to choose the version of the data in CloudKit or the version of the data on Device. My data sort of adds up to an expected whole. If one record is added or deleted, then the sum of the records will be incorrect. To give the user a good experience, I'd like to give them the ability to pick a snapshot of two different versions of their entire data set.Can `NSPersistentCloudKitContainer` facilitate this in anyway?3) Is there a best practices guide or design pattern recommendations with recards to UX anywhere?
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: