The session Using Core Data with CloudKit (https://developer.apple.com/videos/play/wwdc2019/202/) spoke of a sample app for demonstrating the new NSPersistentCloudKitContainer and how it ties Core Data and CloudKit together. I didn't see it listed with the session resources; has it been uploaded somewhere else? If not, when can we expect the sample application to be posted?
Search results for
NSPersistentCloudKitContainer
589 results found
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Trying to set up a test app using NSPersistentCloudKitContainer. Once I got the container set up, got error that attributes must be Optional or provide a default value, which makes sense. Problem is I have one Entity that has a Binary Data field. The field has been marked as Optional.However, the DataModelCompile build step complains that Photo.image must have a default value Also get a CloudKit Integration error along the same lines: Photo.image must have a default value.But there is no way to define a default value for a Binary Data attribute, so don't see a way to fulfill this.Anybody got a clue or do you think its just something I should Radar?
It's not getting removed in iOS 13. In fact, much of the new NSPersistentCloudKitContainer workflow is based on persistent history tracking. See session WWDC 2019 session 202 Using Core Data With CloudKit and session 230 Making Apps with Core Data.
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags:
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?
NSPersistentCloudKitContainer only syncs to a private database, according to the published docs. No mention of public or shared CKDatabase.
Topic:
App & System Services
SubTopic:
Core OS
Tags:
Once I have the path, I plan to do this.lazy var persistentContainer: NSPersistentCloudKitContainer = { let container = NSPersistentCloudKitContainer(name: “MyAppName”) // Create a store description for a CloudKit-backed local store let cloudStoreLocation = URL(fileURLWithPath: Original or Ubiquity Path) let cloudStoreDescription = NSPersistentStoreDescription(url: cloudStoreLocation) cloudStoreDescription.configuration = Cloud // Set the container options on the cloud store cloudStoreDescription.cloudKitContainerOptions = NSPersistentCloudKitContainerOptions( containerIdentifier: com.my.container) // Update the container's list of store descriptions container.persistentStoreDescriptions = [ cloudStoreDescription, ] // Load store container.loadPersistentStores { storeDescription, error in guard error == nil else { fatalError(Could not load persistent stores. (error!)) } } return container}()
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags:
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:
I try to figure out if it's possible to share a users core data events in one app, to another user with CKShare and CKRecord.I got the device sync up and running and can see the changes, also CloudKit dashboard has published the changes to production.However, when I have my NSManagedObject that I got either local or from another device, I try to call the following:let myEvent: // NSManagedObject from core datalet container: NSPersistentCloudKitContainer = AppDelegate.shared.containerlet record = container.record(for myEvent.objectID // not working// record is always nilThe receord is always nil, why?And is is possible to later pass the CKRecord in a UICloudSharingController to share it to another user?
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:
Is there a way to pause or disable syncing via NSPersistentCloudKitContainer at runtime? I want to give my users the option to enable or disable syncing, but there doesn't seem to be a good way to do it. I tried reloading the persistent stores and setting the store description's cloudKitContainerOptions to nil, but if I do that after first initialization, I get an error:error: Store opened without NSPersistentHistoryTrackingKey but previously had been opened with NSPersistentHistoryTrackingKey - Forcing into Read Only modeAnyone know of another way to do this?I submitted a request via Feedback Assistant for a flag to enable or disable syncing (FB6156182). I know the user could theoretically go into the Settings app and enable or disable iCloud access for the app as a whole, but that's not very discoverable, and disables all iCloud access. I'm looking for something a little more fine-grained (limited to the NSPersistentCloudKitContainer) and that I could control in my app's UI.
I'm currently facing the same issue (Also for fetching record IDs). As far as Apple stated here, this function can be used for creating shares, but I'm not sure if the NSPersistentCloudKitContainer is able to work with shared databases.
Topic:
App & System Services
SubTopic:
Core OS
Tags:
Agreed, I read the docs to mean that sharing is possible but I’m not able to use NSPersistentCloudKitContainer methods that return CKRecords based on managed objects at this time. I am hoping this is just due to early beta issues.
Topic:
App & System Services
SubTopic:
Core OS
Tags:
Apparently does not work on simulator only actual devices. See this from Andrew Bancroft https://www.andrewcbancroft.com/blog/ios-development/data-persistence/getting-started-with-nspersistentcloudkitcontainer/
Topic:
App & System Services
SubTopic:
Core OS
Tags:
I am trying to build a very basic app using Core Data and CloudKit. I am logged into my CloudKit account on my Mac, and I followed the instructions to run the sample project that Apple provided on their website.Using the sample project as a guide, I tried to build a simpler app using the instructions provided here.However, after building trying to run my sample project, I get the following error stack trace in my console:CoreData: debug: CoreData+CloudKit: -[PFCloudKitOptionsValidator validateOptions:andStoreOptions:error:](35): Validating options: <NSCloudKitMirroringDelegateOptions: 0x60000097f960> containerIdentifier:iCloud.com.cybermedia.CloudKitTest1 initializeSchema:YES ckAssetThresholdBytes:<null> operationMemoryThresholdBytes:<null> useEncryptedStorage:NO automaticallyDownloadFileBackedFutures:NO automaticallyScheduleImportAndExportOperations:YES skipCloudKitSetup:NO preserveLegacyRecordMetadataBehavior:NO useDaemon:YES apsConnectionMachServiceName:<null> containerProvider:<
I want my exiting project that's using Core Data to enable it use NSPersistentCloudKitContainer.So I set up my project as below documentation Setting Up Core Data with CloudKit says.https://developer.apple.com/documentation/coredata/mirroring_a_core_data_store_with_cloudkit/setting_up_core_data_with_cloudkitBut if I change NSPersistentContainer into NSPersistentCloudKitContainer an error occures.The error message is Use of undeclared type 'NSPersistentCloudKitContainer'.Why this happen?Are there anyone who can solve this problem?Please help me.Thanks in advance.