Search results for

NSPersistentCloudKitContainer

589 results found

Post

Replies

Boosts

Views

Activity

NSPersistentCloudkitContainer makes Cloudkit Metadata Migrator
Hello. Now I'm trying to add Cloudkit + iCloud synchronization feature with NSPersistentCloudkitContainer. It's super easy and cool. However, When I tried some test with large data, there is expensive cost task on every app launch time. Actually, this task also executed on small dataset, but its cost increased by increasing local core data storage. This task seems like migration for cloudkit. I guess that this task save additional data on local storage. (I checked this on Settings > General > iPad Storage) This task takes 20 minutes (with 5GB test data, core data storage) on background thread , using full of one core cpu. Importantly, if there is new data to sync, the synchronization starts after this heavy migration task ends. So if user create new data and terminate application before migration ends, that new data never synchronized. Also, if I delete my cloud data on Settings > Account > iCloud > Manage Storgae, my local app storage remain some of data. My all local data to used on
0
0
763
Jul ’20
NSPersistentCloudKitContainer - creates CD_ CKRecord but does not populate values
I have a working app with core data and cloudkit. I changed the NSPersistentContainer to NSPersistentCloudKitContainer. Two NSManagedObjects 'Contact' and 'Location' already exist in core data with relationships along with some other related NSManagedObjects. Populated core data in 'Contact' and saved. Logged in to CloudKit to see it had created CD_Contact and CD_Location CKRecords along with some other CKRecords. Queried CD_Contact it gave error - index name not available on recordName. So created an Index of type Queryable on recordName and searched again. There is no data in CD_Contact. It is supposed to sync data from core data to cloud Kit, but only CKRecord is created but data saved in core data is not synced and populated in CloudKit. How to fix this? On debug I get this: , CD_contactEmail = crsp@gmail; CD_contactEmail_ckAsset, CD_contact, CD_contactEmail, My AppDelegate Code: let container = NSPersistentCloudKitContainer(name: MyModel) let defaultStoreURL = try! FileManager.default.
0
0
1k
Nov ’22
Migration of a Custom Core Data CloudKit Sync to NSPersistentCloudKitContainer
Hi I have an app that runs on iOS and MacOS (actually they are separate apps) and Core Data from a NSPersistentContainer, is synced with iCloud using a custom solution utilising pre-NSPersistentCloudKitContainer CloudKit methods. I would like to migrate that solution to NSPersistentCloudKitContainer but am having trouble figuring out how to do it and whether it's even possible. In particular, as I cannot guarantee that all devices would migrate at the same time, there would need to be a period where both synchronisation methods are active. Moreover, they would need to be active on one device, which would need to act as some sort of translator between the two methods. Then, it would be quite hard to determine when to stop using and delete old records from the cloud as that would have to be done from the last device to migrate. And that would be quite hard to determine from the app. Finally, as each device has its own Core Data objectIDs all managed objects would end up being duplicated in iCl
0
0
697
Dec ’20
NSPersistentCloudkItContainer and iCloud synchronization speed issues
In our app, there is a scenario where we write and delete approximately 100MB of files to the iCloud server at once using NSPersistentCloudkItContainer(CoreData). While write, read, and delete operations are immediately reflected in the local database, there is a noticeable delay when accessing the CloudKit Database dashboard. Here is the testing approach we have tried: Data Insert Test
 Prepare around 100MB of data.
 Write the data to CoreData on device A.
 When launching the app on device B, it takes about 5 minutes for the data to be fully synchronized. Data Deletion Test Remove all the added data on device A (immediately reflected in local storage.)
 After performing step 1, leaving device A idle takes about 3 minutes for the deletion to be reflected on device B.
 if the app is deleted on device A after step 1, deletion information does not reach device B. Upon reinstalling the app on device A, the deleted data reappears on device B (synchronized data). The ongoing occurrence of these issues has
2
0
643
Jan ’24
NSPersistentCloudKitContainer: Data is gone when turning off iCloud in settings. Reappears when turning it on again.
I am using Core Data with CloudKit through NSPersistentCloudKitContainer. When doing the following, all the data disappears: Start my app (iCloud enabled) Create some items in CoreData Quit the app Turn off iCloud for my app in the iPhone's Settings Start the app again All the items added in step 2 are gone after this. When I turn iCloud on again, they reappear. I read through the documentation, but this does not seem to be expected behaviour. Also, the demo app - https://developer.apple.com/documentation/coredata/synchronizing_a_local_store_to_the_cloud for this topic does not seem to have this issue. However, I am building my CoreData-stack in the same way as they do. Searching on the web it seems that several people have the same issue. Did somebody resolve this? I read that one strategy is to swap NSPersistentCloudKitContainer with NSPersistentContainer in case iCloud is turned off - but the demo-app doesn't do this and still keeps the data even when iCloud gets turned off. So there must
1
0
783
Sep ’20
App unresponsive when calling record(for:) on NSPersistentCloudKitContainer
I'm experiencing an unresponsive UI since MacOS 14.0 and iOS 17.0 when calling record(for: ) or recordID(for:) on the instance of NSPersistentCloudKitContainer. On MacOS, the UI freeze almost always happens when calling the function. On iOS, it is necessary that the device (or simulator) does not have any network connection. I would like to ask if anyone experienced the same problem. I have posted the problem twice to Apple via the Feedback app (once for iOS and once for MacOS). No reply yet on MacOS but on iOS Apple marked it as resolved because apparently no one but me has experienced this problem. In the meantime, I have set up a minimum reproducible example app (MRE).: https://github.com/DominikButz/NotesApp-Cloud-Kit-Record-UI-Freeze- Anyone interested, please read the readme of the repository. It includes step by step instructions on how to reproduce the bug. I can't rule out I have misunderstood the usage of CoreData and CloudKit - in that case please point me in the right direction. The app I
3
0
723
Feb ’24
Reply to Shared NSPersistentCloudKitContainer
It seems like anywhere I read, it says the same thing: It Does Not. Before iOS14 NSPersistentCloudKitContainer only worked with Private Database iOS14 + NSPersistentCloudKitContainer works with Public & Private Databases Soo NSPersistentCloudKitContainer does not work with the Shared Database even if you use CKShare to share the underlying CKRecord object. The user can access the shared object and modify it but through CloudKit Apis and not via NSPersistentCloudKitContainer sync mechanism to CoreData. Also, I have red multiple responses by Apple Engineers, and no where they hinted that they are working on it, or that if it is something technically viable for the future. So at this point, I don't know what to do, since obviously using CKShareApi outside CoreData will require a huge amount of App rewrite. References: https://developer.apple.com/forums/search/?q=NSPersistentCloudKitContainer
Nov ’20
Reply to SwiftData & CloudKit: Deduplication Logic
SwiftData and CloudKit are two different frameworks, and so you are free to use both of them in your app. Note that CloudKit here means the CloudKit framework, not NSPersistentCloudKitContainer. As of today, when you configure SwiftData to use CloudKit, as mentioned in here, SwiftData uses NSPersistentCloudKitContainer underneath to sync the data, and so you won't want to create your own NSPersistentCloudKitContainer instance for the purpose. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Jan ’25
Record Duplication Issue When Migrating NSPersistentCloudKitContainer Persistent Store Location
Hi there! I built an app using Core Data and CloudKit using NSPersistentCloudKitContainer - https://developer.apple.com/documentation/coredata/nspersistentcloudkitcontainer. However, now that I'm looking to add support for extensions, I need to migrate the existing store from its default location using migratePersistentStore(_:to:options:withType:) - https://developer.apple.com/documentation/coredata/nspersistentstorecoordinator/1468927-migratepersistentstore so it can be accessed from a new App Group. Once I update the app to the new build with the migration logic, the store appears empty to CloudKit and the existing objects are re-downloaded to the device. This effectively duplicates all of the records. It seems as though the migrated records are new NSManagedObjects, which would explain why CloudKit doesn't have a corresponding CKRecord. Upon detecting that the CloudKit version of the object does not exist on device, NSPersistentCloudKitContainer ensures that it is created (appea
3
0
2.2k
Jul ’20
App with NSPersistentCloudKitContainer & Binary Data Attribute can't build
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?
2
0
2.1k
Jun ’19
What's the best approach to prefill Core Data store when using NSPersistentCloudKitContainer?
Hello,I'm parsing objects from a JSON file and store them into my Core Data store.I'm using NSPersistentCloudKitContainer and when I'm running the app on a different device, it also parses the JSON file and adds objects to Core Data. That results in duplicate objects.How can I check that an entity already exists remotely ?
2
0
1.4k
Jun ’20
Can the NSPersistentCloudKitContainer mirror the data from the cloudKit public database to the local Core Data if the user is not logged in?
I'm currently syncing Core Data with the CloudKit public database using NSPersistentCloudKitContainer. The app starts with an empty Core Data store locally and at the app launch it downloads the data from CloudKit public database to the Core Data store, but this can only be accomplished if the user is logged in, if the user is not logged, no data gets downloaded and I get the error below. Can the NSPersistentCloudKitContainer mirror the data from the CloudKit public database to the local Core Data even if the user is not logged in? Can someone please confirm this is possible? The reason for my question is because I was under the impression that the users didn't need to be logged to read data from the public database in CloudKit but I'm not sure this applies to NSPersistentCloudKitContainer when mirroring data. I know I can fetch data directly with CloudKit APIs without the user beign logged but I need to understand if NSPersistentCloudKitContainer should in theory work with
4
0
990
Jun ’24
Reply to Safari App Extension fails to connect to CloudKit daemon (cloudd) with XPC communication errors -- CKErrorDomain Code=6 / NSCocoaErrorDomain Code=4099 – Unable to connect to CloudKit daemon
This topic is discussed in the following technote section: Avoid synchronizing a store with multiple persistent containers. The technote is about NSPersistentCloudKitContainer. As of today, SwiftData (DefaultStore) + CloudKit uses NSPersistentCloudKitContainer under the hood, and so the content applies. Basically, the use case of sharing a CloudKit-back store between a main app and its extension and synchronizing with NSPersistentCloudKitContainer isn't quite supported, and so you might consider avoiding do that. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Aug ’25
Can I use NSPersistentCloudKitContainer while at the same time adding extra fields to my CloudKit CKRecord?
For example, because NSPersistentCloudKitContainer doesn't support ordered relationship, I'd like to have an array of references on my CKRecord because CloudKit support NSArray field type; I can then sync these array manually (e.g. persist without relying on Core Data). Is it okay or recommended to do so?
1
0
1.1k
Sep ’22