Search results for

NSPersistentCloudKitContainer

589 results found

Post

Replies

Boosts

Views

Activity

Reply to NSPersistentCloudKitContainer not syncing existing data
Do these records have entries in persistent history? Without them NSPersistentCloudKitContainer can't see the records.This is by design. However we will take your feedback reports on this issue as an enhancement request to make it easier to use NSPersistentCloudKitContainer with existing store files.Keep filing them. Include a sysdiagnose and the persistent store files if you can.
Aug ’19
How do I create a variable for NSPersistentContainer and NSPersistentCloudKitContainer with the same name but set depending on the version?
I cannot change my existing core data stack to NSPersistentCloudKitContainer because that is only a iOS 13 and later support feature but I would like to have that set for iOS 13 and later while having NSPersistentContainer for earlier versions.I have a decent amount of experience working with swift and iOS but have not ever had to do something like this for versioning and certain vars/lets on certain verions.This is my code for my coredata stack for the iOS 13 and later for NSPersistentCloudKitContainer: lazy var persistentContainer: NSPersistentCloudKitContainer = { let container = NSPersistentCloudKitContainer(name: Shopping_App) container.loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error as NSError? { fatalError(Unresolved error (error), (error.userInfo)) } }) return container }()This is my code for iOS 12 and earlier: lazy var persistentContainer: NSPersistentContainer = { let container = NSPersistentContainer(name: Shopping_App
2
0
1.1k
Aug ’19
Reply to How do I create a variable for NSPersistentContainer and NSPersistentCloudKitContainer with the same name but set depending on the version?
That worked purfectly, thank you so much! I honestly did not try that becouse I did not think it would work with line one and three in that block of code. I did not know that even though you set persistentContainer with type of NSPersistentContainer that you could alter that with type NSPersistentCloudKitContainer on line three. I will have to keep that in mind for the furture, thank you.
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’19
Reply to How do I create a variable for NSPersistentContainer and NSPersistentCloudKitContainer with the same name but set depending on the version?
Why don't you use `if #available` ? lazy var persistentContainer: NSPersistentContainer = { if #available(iOS 13.0, *) { let container = NSPersistentCloudKitContainer(name: Shopping_App) container.loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error as NSError? { fatalError(Unresolved error (error), (error.userInfo)) } }) return container } else { let container = NSPersistentContainer(name: Shopping_App) container.loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error as NSError? { fatalError(Unresolved error (error), (error.userInfo)) } }) return container } }()
Topic: Programming Languages SubTopic: Swift Tags:
Aug ’19
Reply to Value of type 'NSPersistentCloudKitContainerOptions' has no member 'shouldInitializeSchema'
For anyone else finding this:You need to call container.initializeCloudKitSchema() after container.loadPersistentStores.You don't really need to call container.initializeCloudKitSchema() at all, as CloudKit will create your schema on the fly. initializeCloudKitSchema just sends some fake data for your model, so it's handy to see if anything's going to break that Xcode didn't warn you about.Here's some code that works in Xcode 11 beta 5 to initialize an NSPersistentCloudKitContainer using a local store and a cloud store (see the Manage Multiple Stores section of the Setting Up Core Data doc). // MARK: - Core Data stack /// Convenience method so you can do DataManager.shared.context instead of DataManager.shared.persistentContainer.viewContext. lazy var context = self.persistentContainer.viewContext /// persistentContainer.viewContext lazy var persistentContainer: NSPersistentContainer = { /* The persistent container for the application. This implementation creates and returns a container, having loade
Aug ’19
Reply to cloudkit sync not getting cloudkit updates
It works in the simulator but syncs only on app startup when you set the automaticallyMergesChangesFromParent-option on the viewContext. See https://stackoverflow.com/questions/56601716/how-to-get-default-project-with-nspersistentcloudkitcontainer-up-and-runningThe actual sync via push notification only works on real devices.
Topic: App & System Services SubTopic: Core OS Tags:
Aug ’19
Reply to NSPersistentCloudKitContainer not syncing existing data
Just utilizing the container doesn't enable the sync. You have to add/request the capabilities throuigh your plist file (iCloud under capabilities, may require background too, but i'm unsure). Pretty sure you need remote notifications as well. I read on a blog somewhere a step by step to get it working, but I haven't found 'Official' instructions for anything more than the class declaration yet. I 'think' I googled NSPersistentCloudKitContainer and tutorial.. or maybe getting started.
Jul ’19
Reply to NSPersistentCloudKitContainer for Shares
The presenter at WWDC 2019 (Nick Gillett) mentioned that Apple maintains a custom Zone in the private database (around 10:50 in the video).Since records get saved in the private database, I would think that CKShares and NSPersistentCloudKitContainer are a no-go combo.But, according to Apple's documentation, you can access the CKRecord for a specific managed object using dedicated methods, which will allow you to create CKShares: https://developer.apple.com... So I am confused.
Topic: App & System Services SubTopic: Core OS Tags:
Jun ’19
Reply to NSPersistentCloudKitContainer for Shares
I've been waiting on CloudKit + CoreData integration for a while, and I don't see how NSPersistentCloudKitContainer can't be used to share. Zero of my users has asked to sync the data between devices, everyone wants to share it between users, and how is such a core feature missing?Have to say, I'm not sure if it's missing because I can't find any documentation or tutorials, but it sure looks that way!
Topic: App & System Services SubTopic: Core OS Tags:
Jun ’19