Search results for

NSPersistentCloudKitContainer

589 results found

Post

Replies

Boosts

Views

Activity

Reply to NSPersistentCloudKitContainer change cloudKitContainerOptions while app is running
I've similar concerns. The contexts from the first container will not be useable (at least in my testing). Short of tearing down the old core data stack, standing up the new one and traversing the view hierarchy to replace all existing managed objects and managed object contexts, there doesn't seem to be a way to toggle sync using NSPersistentCloudKitContainer. Not being able to pause or toggle sync seems to be a real shortcoming with NSPersistentCloudKitContainer. For kicks, I tried just disabling iCloud for the app Settings->AppleID->iCloud->App but that just deleted all the data on the device. I can live with the eventual consistency and not knowing sync progress, but not being able to toggle sync is a show stopper.
Aug ’20
Callback support for NSPersistentCloudKitContainer in iOS14 beta
The callback from syncing of NSPersistentCloudKitContainer is mostly added from iOS14 onwards. I got to know that NSPersistentCloudKitContainer.Event helps to understand sync status of data from CoreData to CloudKit. Use Case: I need to understand the sync status of data from watch to Cloudkit, so that I can choose to send it explicitly to companion phone or not. Has anybody got leads how to use make use of the newly released features forNSPersistentCloudKitContainer in iOS14? For reference : [https://developer.apple.com/documentation/coredata/nspersistentcloudkitcontainer)
2
0
791
Aug ’20
Reply to Setting up push notifications
Hello Steve, After adding the needed capabilities to your project, NSPersistentCloudKitContainer manages the notification configuration to keep your App (local storage) updated with the CloudKit storage. Here - https://developer.apple.com/documentation/coredata/mirroring_a_core_data_store_with_cloudkit/setting_up_core_data_with_cloudkit you can see the steps to enable the capabilities so your NSPersistentCloudKitContainer can keep your local data updated. Now, keep in mind that the freshness of the data from a Public database is different than from a Private database, NSPersistentCloudKitContainer polls for changes on Application Launch and every 30 minutes, see more detail in this year's WWDC session Sync a Core Data store with the CloudKit public database - min 10:30 - https://developer.apple.com/videos/play/wwdc2020/10650/?t=630. Good luck and feel free to reach out.
Topic: App & System Services SubTopic: General Tags:
Aug ’20
Reply to CloudKit Notification for Checking if User Upgraded iCloud Storage Space for error handling?
> Then I'd say it's safe to just keep hitting CloudKit with the same request until it succeeds, keeping any additional errors silenced. Here I see that you are able to listen if quota is exceeded or if the sync is successful or not. Is it a manual sync you are doing to the CloudKit or is the container configured as NSPersistentCloudKitContainer? If it is the later, how are you able to listen to these status callbacks? Any leads would be appreciated. TIA
Sep ’20
[NSPersistentCloudKitContainer] CloudKit integration forbids renaming 'OldEntityName' to 'NewEntityName'. Older devices can't process the new records. How to proceed?
I used a renaming identifier to rename an Entity Name, but it doesn't seem to work and it causes a crash at start during in-place migration. How to rename an Entity Name when using NSPersistentCloudKitContainer? I get this exception at start: CloudKit integration forbids renaming 'OldEntityName' to 'NewEntityName'. Older devices can't process the new records. Unresolved error Error Domain=NSCocoaErrorDomain Code=134110 An error occurred during persistent store migration. App is not in production, need a way to rename 'OldEntityName' to 'NewEntityName'. How to achieve this?
1
0
916
Sep ’20
Reply to NSPersistentCloudKitContainer change cloudKitContainerOptions while app is running
I've posted a suggestion for a sync enabled/disabled switch on NSPersistentCloudKitContainer through the feedback tool (FB8571301). This is the reply I got: We do not encourage applications to implement their own sync controls. The user can control the sync state of an application using the iCloud Preferences in the Settings app. The problem is that the iCloud preferences in the settings app are rather hidden.. And there is no way to directly link to this page from my app. There are inherent ownership challenges with toggling between synced and unsynced data. For this reason we recommend using a separate persistent store to hold unsynced data separately from the user’s iCloud data. This is necessarily a heavy-weight operation, the local store must be added and the cloud store removed when the user disables sync. You can customize the persistent store descriptions of a container after it is initialized. For example, you can set the store descriptions on it immediately, which will prevent the default d
Sep ’20
Is it possible to rename Entities after using NSPersistentCloudKitContainer in Core Data?
I've tried using renaming Identifier: 1) Automatic / Lightweight migration seems to fail, because CloudKit integration forbids renaming entities. older devices cannot process these records 2) Tried using just NSPersistentContainer, and the lightweight migration still fails with the above message. NSPersistentCloudKitContainer seems to have marked/tainted the persistent store / SQLite so that renaming of entities is not possible at all. Does anyone know if it is possible to rename entities once you start using NSPersistentCloudKitContainer? (heavyweight migration or such?) Has anyone done this before, in a production app or otherwise?
1
0
1k
Sep ’20
Share an object managed by NSPersistentCloudKitContainer with other users
One question I often see on DevForums and in my day DTS job is if a Core Data object managed by NSPersistentCloudKitContainer can be shared with other iCloud users. The answer is yes but you need to do it using CloudKit API directly because NSPersistentCloudKitContainer doesn’t support CloudKit shared database (CKContainer.sharedCloudDatabase) today. Assuming you have a Core Data object, let’s say a document, that you’d like to collaborate with your colleagues: You are the document owner and can use NSPersistentCloudKitContainer to fully manages the document and synchronize it across your devices. You can grab a CloudKit record associated with your document from NSPersistentCloudKitContainer using record(for:) or recordID(for:), and share it to your colleagues using UICloudSharingController. See our Sharing CloudKit Data with Other iCloud Users - https://developer.apple.com/documentation/cloudkit/sharing_cloudkit_data_with_other_icloud_users sample for how to share a CloudK
2
0
978
Sep ’20
Reply to Share an object managed by NSPersistentCloudKitContainer with other users
Hi thank you for making this post. This is really helpful. I have a follow up. There is a 5th point that is missing. What happens when the owner modifies something in the shared document. The other participant can't use private database auto synced with NSPersistentCloudKitContainer because they must use CKContainer.sharedCloudDatabase for shared documents. How to I manually fetch the changes in real time reliability? I saw Maintain a Local Cache For CloudKit Records described here https://developer.apple.com/documentation/cloudkit/sharing_cloudkit_data_with_other_icloud_users but do not understand it. Could you please describe in simpler steps to keep the CKContainer.sharedCloudDatabase synced in real time. Thank you 🙏
Sep ’20
Using NSPersistentCloudKitContainer causes crash for iOS 14
In iOS 14, I am trying to use the NSPersistentCloudKitContainer, but there is a crash with the following error message: ** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Must register a handler for activity identifier com.apple.coredata.cloudkit.activity.export.[an UUID] before submitting it' terminating with uncaught exception of type CKException Does anyone else have this error? Is there any workaround for this? I have already filled a bug report FB8618522 Thanks in advance!
11
0
3.2k
Sep ’20
NSPersistentCloudKitContainer does not sync in background
I am currently testing the NSPersistentCloudKitContainer. I have strictly followed the guidelines of the new documentation. Basically everything works as desired. I use the option NSPersistentStoreRemoteChangeNotificationPostOptionKey on the description to receive Updates from the remote data store. But the updates from the remote database are only delivered if the app is in the foreground. But I would like to update my widget based on a data change in the backend. Does anyone has an idea how to solve this issues? What i did so far: Background Modes in Capabilities are enabled Push Notifications are enabled i called registerForRemoteNotifications HistoryTracking and RemoteChange Option are enabled on the description of the PersistentStore Syncing works in foreground ✅ Syncing does not work if App is in Background ❌ forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey) description?.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey) container.viewContext.automaticallyMergesCh
1
0
889
Sep ’20
CoreData with CloudKit in WidgetKit not working
In my app, I have an NSPersistentCloudKitContainer set up in the following way: let container: NSPersistentCloudKitContainer init() { self.container = NSPersistentCloudKitContainer(name: Model) self.container.persistentStoreDescriptions[0].setOption( true as NSNumber, forKey: NSPersistentStoreRemoteChangeNotificationPostOptionKey } self.container.loadPersistentStores { (_, error) in guard error == nil else { print(error loading store: (error.debugDescription)) return } } self.container.viewContext.automaticallyMergesChangesFromParent = true } When I invoke a fetch request on the context of the container in my iOS target, it works as expected. However, when I perform the same fetch request in my Widget target, it returns an empty array result. In my iOS target, I have Background Modes / Remote Notifications and iCloud / CloudKit capabilities. In my Widget target, I have the iCloud / CloudKit capability. Not sure why it isn't working, so any help would be much appreciated, thanks!
3
0
1.1k
Sep ’20
Cloudkit is broken (sort of) in simulator
I am developing an app that uses NSPersistentCloudKitContainer. I am seeing lots of inconsistency. But....after a long time observing...I strongly believe the simulator implementation of cloudkit is broken. Log in via your icloud Open the built in Apple reminder app in both simulator and on your physical device. You will notice that changes made in simulator propagate reasonably well to the device....but any changes made on device don't propagate to the simulator reminders app...you need to force quit app on simulator for changes to reflect. The ultimate example app is apple notes. It handles sync better than any other app out there. I still am in the process of understanding why my app does not sync as well as notes, eg playing around with things like: container.viewContext.mergePolicy = NSMergeByPropertyStoreTrumpMergePolicy container.viewContext.automaticallyMergesChangesFromParent = true NotificationCenter.default.addObserver(self, selector: #selector(storeRemoteChangeNotification), name: NSNotif
0
0
503
Sep ’20
CloudKit's public container can be accessed on wifi, but not on the cellular network
I'm attempting to write to the public container of CloudKit, but I keep getting the error message: CKError 0x281ff9ec0: Network Unavailable (3/NSURLErrorDomain:-1009); The Internet connection appears to be offline. only when I'm accessing the container through the cellular network. When I try on a wifi network, however, it works perfectly fine and can confirm the presence of the uploaded data on the dashboard. There is absolutely nothing wrong with the cellular connectivity of my device. let publicCloudDatabase = CKContainer.default().publicCloudDatabase let operation = CKModifyRecordsOperation(recordsToSave: [exampleRecord], recordIDsToDelete: nil) let operationConfiguration = CKOperation.Configuration() operationConfiguration.allowsCellularAccess = true operationConfiguration.qualityOfService = .userInitiated operation.configuration = operationConfiguration operation.perRecordProgressBlock = {(record, progress) in ttprint(progress) } operation.perRecordCompletionBlock = {(record, error) in ttprint(Upload co
2
0
1.3k
Sep ’20