Search results for

NSPersistentCloudKitContainer

589 results found

Post

Replies

Boosts

Views

Activity

Reply to NSFetchedResultsController use-after-free issues in iOS 16.1
Yup! I am suddenly seeing a lot of crash reports (over 100 in the last couple of days) and ALL from users on iOS 16.1. This is new and nothing in that part of the App changed. Crashing right after the CoreData is initialized and NSPersistentCloudKitContainer is ready. At that point the controller does a fetchRequest for items in the Table and Crash with some kind of memory error. In my case it is simply making a request for items sorted alphabetically?!
Topic: App & System Services SubTopic: Core OS Tags:
Dec ’22
NSPersistentCloudKitContainer - Import failed with error: Error Domain=NSCocoaErrorDomain Code=4864
The NSPersistentCloudKitContainer synchronization between core data and iCloud was working fine with phone 15.1. Connected a new iPhone iOS 15.5, it gives error: CoreData: debug: CoreData+CloudKit: -[NSCloudKitMirroringDelegate managedObjectContextSaved:](2504): : Observed context save: - 2022-12-05 13:32:28.377000-0600 r2nr[340:6373] [error] error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _importFinishedWithResult:importer:](1245): : Import failed with error: Error Domain=NSCocoaErrorDomain Code=4864 *** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: incomprehensible archive (0x53, 0x6f, 0x6d, 0x65, 0x20, 0x65, 0x78, 0x61) UserInfo={NSDebugDescription=*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: incomprehensible archive (0x53, 0x6f, 0x6d, 0x65, 0x20, 0x65, 0x78, 0x61)} CoreData: error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _importFinishedWithResult:importer:](1245): : Import failed with error: Error Domain=NSCocoaErro
2
0
1.1k
Dec ’22
FB11794798: NSPersistentCloudKitContainer throws lots of error / debug messages
Hi, When using NSPersistentCloudKitContainer lots of error / debug messages are shown in Xcode Debug area. Feedback FB11794798: Overview When I use NSPersistentCloudKitContainer I get the following error / debug messages printed on the Xcode Debug Area. Syncing seems to happen fine. Tested on device and simulator. I am still using Development (not deployed to Production yet) I even tried with a new project using the default code generated for by enabling CloudKit coredata sync and I still get the same messages. I have filed a feedback FB11794798 Steps to Reproduce Create a new project check Use CoreData and Host in CloudKit check boxes Run the project Notice the error messages shown below. Questions How to resolve these errors? Or is this a bug from the Apple Frameworks? (Feedback FB11794798) Error / debug message printed on Xcode debug area CoreData: debug: CoreData+CloudKit: -[PFCloudKitOptionsValidator validateOptions:andStoreOptions:error:](36): Validating options: containerIdentifier:
0
0
1.4k
Nov ’22
Reply to Logger messages not showing in XCode console
@eskimo I am using Logger (OSLog) and I don't want debug messages from frameworks like mentioned below. What should I do to achieve that? When I use CoreData / CloudKit especially NSPersistentCloudKitContainer I do see a lot of debug messages such as the ones below: CoreData: debug: CoreData+CloudKit: -[PFCloudKitOptionsValidator validateOptions:andStoreOptions:error:](36): Validating options: containerIdentifier: databaseScope:Private ckAssetThresholdBytes: operationMemoryThresholdBytes: useEncryptedStorage:NO useDeviceToDeviceEncryption:NO automaticallyDownloadFileBackedFutures:NO automaticallyScheduleImportAndExportOperations:YES skipCloudKitSetup:NO preserveLegacyRecordMetadataBehavior:NO useDaemon:YES apsConnectionMachServiceName: containerProvider: storeMonitorProvider: metricsClient: metadataPurger: scheduler: notificationListener: containerOptions: defaultOperationConfiguration: progressProvider: test_useLegacySavePolicy:YES archivingUtilities: bypassSchedulerActivityForInitialImport:NO stor
Topic: App & System Services SubTopic: Core OS Tags:
Nov ’22
SwiftUI macOS app not syncing with iCloud
I have an iOS and iPadOS app that use iCloud to sync. They are in the App Store and the database was pushed to production. They work as advertised. I wrote also a macOS app that uses Cloudkit, the container it set as NSPersistentCloudKitContainer and the merge policies are set ok. I also checked that the profile for the app and certificates are good to go, as well as the permissions of the app. Apple signed the app, but, it doesn't sync with iCloud and I can't figure out why. I checked iCloud on my Mac and the app is there, set to be syncing. I have already read a few articles and have tried all the possible solutions, including signing out and back in, rebuilding the app, etc. One thing, thought, when I delete an item, the app takes sometime to react to it, as if it's trying to connect. I tried with TCPDump, and other things to check for connection issues, but I can't find that app trying to connect. I took a few screenshots of the different configs, etc so you can see as well, but has anyone run in
2
0
2.1k
Nov ’22
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
CloudKit UICloudSharingController `recordChangeTag specified, but record not found`
Hello! I'm using NSPersistentCloudKitContainer for storing data and UICloudSharingController for sharing. Here's how UICloudSharingController is created: func share(_ record: Record, avatar: UIImage) { let controller = shareControllerForRecord(record, avatar: avatar) controller.delegate = self controller.popoverPresentationController?.sourceView = self.view controller.popoverPresentationController?.permittedArrowDirections = [] present(controller, animated: true) } func shareControllerForRecord(_ record: Record, avatar: UIImage) -> UICloudSharingController { if let share = share(for: record) { let controller = UICloudSharingController(share: share, container: self.cloudKitContainer) return controller } else { let controller = UICloudSharingController { [weak self] (controller, completion: @escaping (CKShare?, CKContainer?, Error?) -> Void) in guard let self = self else { return } self.persistentContainer.share([record], to: nil) { objectIDs, share, container, error in if let share = share { rec
0
0
810
Oct ’22
CloudKit - How to use Configurations to properly segregate public and private data
I am trying to understand the concepts between two of the CloudKit code samples: CoreDataCloudKitDemo, which shows sync between CoreData and CloudKit CoreDataFetchedProperty which shows how you can keep public and private data in two CoreData configurations and join them together. After some trial and error I created a single NSPersistentCloudKitContainer that I thought used the two separate configurations - each had it's own local persistent store, database scope was set properly for both stores, etc. But when I run the app it complained of the following: Failed to load persistent stores:Error Domain=NSCocoaErrorDomain Code=134060 A Core Data error occurred. UserInfo={NSLocalizedFailureReason=CloudKit integration does not allow relationships to objects that aren't sync'd. The following relationships have destination entities that not in the specified configuration. EntityA: entityB - EntityB So, I went back to the model and although I had created two separate Configurations (with EntityA in one and
2
0
1.3k
Oct ’22
Reply to 0xdead10cc & NSPersistentCloudKitContainer
HI, Asking for more background time doesn't feel like a solution, that will just postpone the crash. Actually, that is the answer, at least partly. The reason this can't really happen: In my naiveté I assumed that NSPersistentCloudKitContainer and Core Spotlight would release any locks when app is suspended. ...is that the system can't really know in advance what you're going to ask it to do. They actually take out some of their own tasks, but that doesn't really help if the suspension process is starting at roughly the same time you're asking them to do work. That solution here is to create your own background task for the larger job that you're trying to finish (Add some stuff to my CoreSpotlight index) and end it once the work is done. -Kevin Elliott DTS Engineer, CoreOS/Hardware
Oct ’22
0xdead10cc & NSPersistentCloudKitContainer
We're receiving crash reports where our app is killed by the system because of 0xdead10cc. If I understand correctly this is happening because our app has a file lock or SQLite database lock. Our app is using NSPersistentCloudKitContainer and is indexing the data to Core Spotlight. In my naiveté I assumed that NSPersistentCloudKitContainer and Core Spotlight would release any locks when app is suspended. What is the best way to solve this? Asking for more background time doesn't feel like a solution, that will just postpone the crash.
1
0
1.3k
Oct ’22
How to enable/disable cloudkit in runtime.
I am trying to implement toggling iCloud sync in runtime for my App, i.e. when users toggle the switch in my app, a persistent container will be created according to sync on or off. it works when relaunching the app after changing the container, but how to do it in runtime? how to reload data from the new container and refresh into UIs which already contain the old data from the previous container? I searched all over the internet but could not find a solution to toggle iCloud sync in runtime properly. Below is the code from my core data stack: lazy var persistentContainer: NSPersistentContainer = { setupPersistentContainer() }() private func setupPersistentContainer() -> NSPersistentContainer { let isSyncOn = UserDefaults.standard.bool(forKey: isSyncOn) let container = isSyncOn ? NSPersistentCloudKitContainer(name: BaseTypes) : NSPersistentContainer(name: BaseTypes) guard let description = container.persistentStoreDescriptions.first else { fatalError(###(#function): Failed to retrieve a persisten
0
0
1.1k
Oct ’22
Core Data + CloudKit - data record type does not appear in CloudKit Dashboard
I created a blank SwiftUI project and included Core Data and Cloud Kit. By selecting Core Data and CloudKit while creating the project, Apple already included some Core Data sample code and entities in the project, and also a Persistence.swift file that contained NSPersistentCloudKitContainer code. The sample code included a SwiftUI list in ContentView, with an Add button to add timestamp to the list when pressing. **I suppose after some basic setup to the project and created the CloudKit container, the app data will auto sync and can be viewed in CloudKit dashboard, but it didn't. ** Here is what I have setup: Created the project with Core Data and Cloud Kit Haven't touch any code from the Persistence.swift file since Apple has already set it up. Also haven't touch the app struct, content view and core data entities (left all sample code untouched) Selected Automatically Manage Signing and Development Team, with a paid developer acc. Added iCloud Capability Selected CloudKit in iCloud Capability, Cr
2
0
1.8k
Sep ’22
Reply to Can I use NSPersistentCloudKitContainer while at the same time adding extra fields to my CloudKit CKRecord?
hi, my guess is that you're playing with fire if you go behind NSPersistentCloudKitContainer's back (!) if you want to keep the notion of an ordered set for a relationship among two entities that is A <---->> B (many B entities associated with an A, but only one A entity is associated with a given B), then two options come to mind (and these can be handled directly on the Core Data side). first, add an integer attribute to B to indicate its relative position among all its sibling B objects. if A changes the order of the B objects, just rewrite the position of each (or as may as needed) associated B. second ... perhaps if each B object represents lots of data and you think it an expensive operation to rewrite many B objects when reordered ... then consider adding an intermediate entity C with one integer attribute (perhaps named position) and two relationships: one from C to A (many-to-one) and one from C to B (one-to-one), so that you have A <---->> C <----> B. in essence, eac
Sep ’22
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