Search results for

NSPersistentCloudKitContainer

589 results found

Post

Replies

Boosts

Views

Activity

Reply to Error: Failed to sync user keys in simulator
Problem 1: NSPersistentCloudKitContainer doesn't seem to work on simulator Solution: Use device, haven't found a way to make it work on the simulator. Problem2 When using CloudKit APIs (not NSPersistentCloudKitContainer) on the simulator I was getting CKError.notAuthenticated even though I had signed into iCloud on the simulator Root cause This happens when 2FA was enabled on the iCloud account but the 2FA code was asked on the simulator Solution Go to https://appleid.apple.com/, select devices on the sidebar Remove simulator (I found 2 simulators, removed both) Reset Xcode simulator Log into iCloud on the simulator Run the app Hopefully that should work.
Aug ’22
[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
NSPersistentCloudkitContainer Memory Leak -> Crash? (iOS 15 beta 4 & 5)
Background I have an established app in the App Store which has been using NSPersistentCloudkitContainer since iOS 13 without any issues. I've been running my app normally on an iOS device running the iOS 15 betas, mainly to see problems arise before my users see them. Ever since iOS 15 (beta 4) my app has failed to sync changes - no matter how small the change. An upload 'starts' but never completes. After a minute or so the app quits to the Home Screen and no useful information can be gleaned from crash reports. Until now I've had no idea what's going on. Possible Bug in the API? I've managed to replicate this behaviour on the simulator and on another device when building my app with Xcode 13 (beta 5) on iOS 15 (beta 5). It appears that NSPersistentCloudkitContainer has a memory leak and keeps ramping up the RAM consumption (and CPU at 100%) until the operating system kills the app. No code of mine is running. I'm not really an expert on these things and I tried to use Instruments to see i
25
0
13k
Aug ’21
Reply to iCloud Issues
We will need a feedback report with a sysdiagnose to investigate why the server is unhappy with your request. Typically these are configuration issues of some kind. https://developer.apple.com/documentation/technotes/tn3163-understanding-the-synchronization-of-nspersistentcloudkitcontainer#Capture-a-sysdiagnose
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’24
Reply to NSPersistentCloudKitContainer and CloudKit for Sharing
Yes, NSPersistentCloudKitContainer doesn't support sharing, you have to implemented that code manually. Here's a great walkthrough along with some sample code: https://developer.apple.com/documentation/cloudkit/sharing_cloudkit_data_with_other_icloud_users You can obtain an NSManagedObject's underlying CKRecord using https://developer.apple.com/documentation/coredata/nspersistentcloudkitcontainer/3141668-record Basically, you need to create a CKShare for each record you'd like to share. Don't forget to setup a CKDatabaseSubscription to get notified about changes. After changing the record, receivers of the share need to store it back to the shared database (and not to their private database, unless they're the owner of the record).
Jun ’20
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
Reply to Not receiving Persistent Store Remote Change Notification.
I think in built constants have to be used for keys so i changed the code to following... - (NSPersistentCloudKitContainer *)persistentContainer { // The persistent container for the application. This implementation creates and returns a container, having loaded the store for the application to it. @synchronized (self) { if (_persistentContainer == nil) { _persistentContainer = [[NSPersistentCloudKitContainer alloc] initWithName:@Expenses]; [_persistentContainer loadPersistentStoresWithCompletionHandler:^(NSPersistentStoreDescription *storeDescription, NSError *error) { if (error != nil) { #ifdef DEBUG NSLog(@Unresolved error %@, %@, error, error.userInfo); #endif abort(); } else { #ifdef DEBUG NSLog(@Store successfully initialized); #endif [storeDescription setOption:[NSNumber numberWithBool:YES] forKey:NSPersistentHistoryTrackingKey]; [storeDescription setOption:[NSNumber numberWithBool:YES] forKey:NSPersistentStoreRemoteChangeNotificationPostOptionKey]; } }]; } return _persistentContainer
Aug ’22
Reply to Sync an interactive widget's Core Data store with the main app (and iCloud)
Showing a hint to users inside the widget that they should open the main app in order to sync is hardly a practical solution and destroys not only the user experience, but the very purpose of interactive widgets. If I need to open the app each time I've pressed a button on the widget, it's not very interactive after all. Yeah, your above argument is quite valid, and is why the technote mentions if that is an appropriate user experience. In this case, you might consider using CloudKit framework directly in your widget. That way, you manage the synchronization with your own code, without relying on NSPersistentCloudKitContainer. To read the data that is on the CloudKit server and is maintained by NSPersistentCloudKitContainer, see Reading CloudKit Records for Core Data. The data your widget writes to the CloudKit server using CloudKit APIs, assuming that it follows the rules described in the above article, should be able to synchronize with NSPersistentCloudKitContainer. This is more
Apr ’25