nspersistentcloudkitcontainer

Forcing NSPersistentContainer change Core Data

痞子三分冷 提交于 2021-02-06 09:13:44
问题 I just added the option for a user to toggle Cloud sync inside my app where I save whether or not the user wants to use iCloud sync in UserDefaults under "useCloudSync". I load my persistentContainer when the app runs with: class CoreDataManager { static let sharedManager = CoreDataManager() private init() {} lazy var persistentContainer: NSPersistentContainer = { var useCloudSync = UserDefaults.standard.bool(forKey: "useCloudSync") let containerToUse: NSPersistentContainer? if useCloudSync {

Forcing NSPersistentContainer change Core Data

人走茶凉 提交于 2021-02-06 09:13:32
问题 I just added the option for a user to toggle Cloud sync inside my app where I save whether or not the user wants to use iCloud sync in UserDefaults under "useCloudSync". I load my persistentContainer when the app runs with: class CoreDataManager { static let sharedManager = CoreDataManager() private init() {} lazy var persistentContainer: NSPersistentContainer = { var useCloudSync = UserDefaults.standard.bool(forKey: "useCloudSync") let containerToUse: NSPersistentContainer? if useCloudSync {

NSPersistentCloudKitContainer: How to check if data is synced to CloudKit

末鹿安然 提交于 2020-12-27 08:39:05
问题 I have implemented NSPersistentCloudKitContainer to get my data synced to CloudKit , I would like to know that the sync is finished and there is no other change pending to be synced. When I tried reinstalling the app, I start getting my data back from CloudKit and it started printing certain logs in the console. It takes around 30 seconds to get all my data back from the CloudKit. Some of the logs mention about NSCloudKitMirroringDelegate . It looks like NSCloudKitMirroringDelegate knows

Share Core Data between users with NSPersistentCloudKitContainer

给你一囗甜甜゛ 提交于 2020-07-18 05:40:30
问题 Apple introduced the NSPersistentCloudKitContainer with iOS13 which enable us to use CloudKit with Core Data. I got it working pretty much instantly on different devices but my main issue is still left. Is it possible to share the data in an easy way with other users? I've been reading on CKShare but don't see how I can go from NSPersistentCloudKitContainer to that in an easy way. 回答1: There are methods on NSPersistentCloudKitContainer for accessing the underlying cloudkit records: https:/

Issue with optional Core Data relationship using NSPersistentCloudKitContainer

拥有回忆 提交于 2020-06-26 12:23:48
问题 I am using NSPersistentCloudKitContainer, not sure if that's the cause of my issue or CloudKit generic behaviour. The sync setup works fine so far. I am now adding a new feature, causing some an issue: I have an entity Item, which can be put in a Group. Relation in CD is to-one and optional. Works fine on device: I can set and remove group, everything is persisted. But CloudKit just ignores when I remove the group. It does not complain, just ignores it. No matter if remove happens from Item,

NSPersistentStoreRemoteChangeNotification not getting fired

会有一股神秘感。 提交于 2020-06-25 20:19:39
问题 I am trying to perform history tracking in my CoreData+CloudKit project which uses NSPersistentCloudKitContainer . I have been following along with Apple's sample project I want to perform certain task when the remote store has been updated. For this apple recommends enabling remote notification in the Signing & capabilities's Background Mode section of the app. I have enabled History Tracking for my project as shown in Apple's sample project. // turn on persistent history tracking let

NSPersistentStoreRemoteChangeNotification not getting fired

我只是一个虾纸丫 提交于 2020-06-25 20:18:29
问题 I am trying to perform history tracking in my CoreData+CloudKit project which uses NSPersistentCloudKitContainer . I have been following along with Apple's sample project I want to perform certain task when the remote store has been updated. For this apple recommends enabling remote notification in the Signing & capabilities's Background Mode section of the app. I have enabled History Tracking for my project as shown in Apple's sample project. // turn on persistent history tracking let

Relationship persistence with NSPersistentCloudKitContainer

こ雲淡風輕ζ 提交于 2020-06-24 10:08:50
问题 I'm working on an app that uses NSPersistentCloudKitContainer to share data between devices. The core data model has multiple entities, two of which are connected using a relationship with it's respective inverse. The issue I'm having is that when I set the relationship to nil the cloud data is not updated and when I restart the app, the relationship gets reset back what it was before it was set to nil . Is this a bug in the new NSPersistentCloudKitContainer ? Is anyone else having this issue