Search results for

NSPersistentCloudKitContainer

589 results found

Post

Replies

Boosts

Views

Activity

Cannot see records in the iCloud Production environment
I'm attempting to use Core Data + CloudKit to persist user's data with the NSPersistentCloudKitContainer class. I'm able to see created records in the Development environment but records won't show in the Production environment. With just this brief description, what could be the issue? Notes I have deployed the schema to the Production environment. I'm using the same device and iCloud account for both environments My Apple ID is the same for my personal and dev account. I'm attempting to add records to Production via a TestFlight build The iCloud toggle for the app is ON. What are some initial thoughts as to why there is a sync issue?
0
0
507
Oct ’21
Detect/Receive CloudKit CoreData Errors
In development I've switched to NSPersistentCloudKitContainer and have begun the terrifying process of trying to test as many scenarios as possible to make sure nobody loses any data. During some testing I saw an error like this: I was able to fix this, but it was only affecting some scenarios and if this had happened to a real user they (and I) would never have known about the problem, and their data would not have synced to CloudKit. If the store fails to load you get an error, but if it loads but doesn't sync you don't. So my question is: is there a way to receive these kind of errors in code? I have looked for notifications and delegate methods and I can't find any.
1
0
1.2k
Jul ’20
Sync for the first time the CloudKit data
My app backup the data to iCloud or sync with user device through the user iCloud account using NSPersistentCloudKitContainer privateDataBase. The main problem is, when user install the app I need to know if user has data in iCloud or not according this information, I let user to setup account or fetch the existing account, since it takes too long to fetch with local CoreData, I am trying to find a way to fetch directly from iCloud through CloudKit, since I am new in CloudKit, I don't know how to fetch data from CloudKit any help appreciate.
0
0
729
May ’22
Changing relationship delete rule & CloudKit
Hi, any side effect to be aware of when changing a core data relationship delete rule from Null to Cascade? I NSPersistentCloudKitContainer to handle CloudKit sync in case that's relevant. It doesn't look like any migration is required, and the cloudkit schema doesn't change so it seems there's nothing to do on the cloudkit-side either. However I'd prefer to double check to avoid making false assumptions. I wasn't able to find any documentation on that particular point so if someone can shade some light on how things work under the hood that would be appreciated. Thanks!
0
0
914
Jun ’22
Avoid Duplicate Records with CloudKit & CoreData
When my app starts it loads data (of vehicle models, manufacturers, ...) from JSON files into CoreData. This content is static. Some CoreData entities have fields that can be set by the user, for example an isFavorite boolean field. How do I tell CloudKit that my CoreData objects are 'static' and must not be duplicated on other devices (that will also load it from JSON files). In other words, how can I make sure that the CloudKit knows that the record created from JSON for vehicle model XYZ on one device is the same record that was created from JSON on any other device? I'm using NSPersistentCloudKitContainer.
3
0
3.3k
Feb ’22
Core Data + CloudKit crash on startup only in production
Hi, My macOS app's production build is crashing on start with an unhelpful crashdump. In the console, the only error in the Console is BUG IN CLIENT OF CLOUDKIT: Not entitled to listen to push notifications. Please add the 'com.apple.private.aps-connection-initiate' entitlement. Adding this entitlement to my entitlements.plist breaks the app entirely (Unsatisfied entitlements). Here is how I'm loading my persisten store: lazy var persistentContainer: NSPersistentCloudKitContainer = { let container = NSPersistentCloudKitContainer(name: ChatModel) guard let description = container.persistentStoreDescriptions.first else { fatalError(###(#function): Failed to retrieve a persistent store description.) } if(UserDefaults.standard.bool(forKey: StoredPreferenceKey.iCloudSync)){ description.cloudKitContainerOptions = NSPersistentCloudKitContainerOptions(containerIdentifier: iCloud.XXXXX) } else { description.cloudKitContainerOptions = nil } description.setOption(true as NSNumber, forKey: NSPersistentH
2
0
955
May ’23
WidgetKit + CoreData with CloudKit
Hi, I am developing an app with CoreData + CloudKit and wanted my Widget to fetch data from CloudKit to display. Everything is working on iOS / watchOS, but on WidgetKit the result from my fetch is always empty. I already configured the CloudKit capability on the Widget extension, then I am creating a new NSPersistentCloudKitContainer the and on public func timeline(with context: Context, completion: @escaping (Timeline<Entry>) -> ()) { I am trying to let cardsFetch = NSFetchRequest<Card>(entityName: Card) do { let cards = try persistentContainer.viewContext.fetch(cardsFetch) the result is always 0 and the same fetch on iOS returns the data. Is this supposed to work?
8
0
3.3k
Jul ’20
CloudKit - initializeCloudKitSchema error
Hi, I've previously used a local core data database successfully with my app and now I wanted to use NSPersistentCloudKitContainer to store the data in CloudKit. However when I do container.initializeCloudKitSchema(options: []) I receive an error which I'm not able to comprehend: CoreData: error: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _requestAbortedNotInitialized:](2112): - Never successfully initialized and cannot execute request ' 17E8940B-00D6-4D01-AA78-6A04EBEBC957' due to error: ... 9 Batch Request Failed CKError's omited ... }> I also get this error in the console: Atomic failure = I've tried to reset Reset Environment in the CloudKit dashboard to no avail.
1
0
1.1k
Apr ’23
Error when calling initializeCloudKitSchema
I am trying to setup my CloudKit schema from CoreData using the NSPersistentCloudKitContainer but getting an error when calling try container.initializeCloudKitSchema() The error: Error Domain=NSCocoaErrorDomain Code=134060 A Core Data error occurred. UserInfo={encounteredErrors=( Error Domain=NSCocoaErrorDomain Code=134406 Request '07443E71-32AC-4E63-A163-AAF940FE1AD6' was aborted because the mirroring delegate never successfully initialized due to error: UserInfo={NSLocalizedFailureReason=Request '07443E71-32AC-4E63-A163-AAF940FE1AD6' was aborted because the mirroring delegate never successfully initialized due to error: } )} My container is iCloud., and is reflected in the Entitlement file.
1
0
1.1k
Aug ’22
Share sheet configuration
I'm trying to configure the share sheet. My project uses techniques from the Apple Sample project called CoreDataCloudKitShare which is found here: https://developer.apple.com/documentation/coredata/sharing_core_data_objects_between_icloud_users# In this sample code there's a PersistenceController which is an NSPersistentCloudKitContainer. In the PersistenceController+SharingUtilities file there are some extensions, and one of them is this: func configure(share: CKShare, with photo: Photo? = nil) { share[CKShare.SystemFieldKey.title] = A cool photo } This text A cool photo seems to be the only bespoke configuration of the share sheet within this project. I want to have more options to control the share sheet, does anyone know how this might be achieved? Thank you!
Topic: UI Frameworks SubTopic: SwiftUI
1
0
679
Nov ’24
Core Data Entity Inside Another Entity
So I have an entity in my core data model called recipe. I need to create another entity containing a recipe and a date that the recipe is assigned to. Can I do this similar to the way I've done it in the image and just save a Recipe object in the initialization of PlannedRecipe object in the Persistence file? Basically I just need to know how to add a entity in an entity using this core data model and persistence file. Persistence file: import CoreData struct PersistenceController { static let shared = PersistenceController() let container: NSPersistentCloudKitContainer init(inMemory: Bool = false) { container = NSPersistentCloudKitContainer(name: ReciPrep) if inMemory { container.persistentStoreDescriptions.first!.url = URL(fileURLWithPath: /dev/null) } container.loadPersistentStores(completionHandler: { (storeDescription, error) in if let error = error as NSError? { fatalError(Unresolved error (error), (error.userInfo)) } }) container.viewContext.automaticallyMergesChangesFromParent = tru
2
0
1.2k
Jun ’22
CloudKit and CoreData public database
Core Data with CloudKit uses a specific record zone in the CloudKit private database, which is accessible only to the current user.It's not possible to use CloudKit and CoreData with the CloudKit public database? Here is my scenario.- I have an application with two core data stores.- The first store should be synced with the public CloudKit database and NOT updated by the user.- The second store should be synced with the private CloudKit database and updated by the user.lazy var persistentContainer: NSPersistentCloudKitContainer = { let container = NSPersistentCloudKitContainer(name: MyAppName) // Create a store description for the first store let firstStoreLocation = URL(fileURLWithPath: /path/to/first.store) let firstStoreDescription = NSPersistentStoreDescription(url: firstStoreLocation) firstStoreDescription.configuration = First // Create a store descpription for the second store let secondtoreLocation = URL(fileURLWithPath: /path/to/second.store) let secondStoreDescription = NSPersiste
2
0
4.7k
Aug ’19
Switching from production to development database
Hello! I have a live app in the appstore which uses NSPersistentCloudKitContainer. When I was working on the app, whatever data was created while testing was reflecting in the Development section of the CloudKitDashboard. Then, when time came for releasing the app, I had pushed my schema to production and everything has been working well. Recently, I have been working to make some changes in my code and while testing I realised that that I am being pointed to Production. Now how do I move back to using Development while working on the app. I have tried changing values of in .entitlement file. But it still does not give me what I want. Below is my entitlement values: aps-environment development com.apple.developer.icloud-container-environment Development com.apple.developer.icloud-container-identifiers Does anyone have any suggestions?
0
0
489
Jun ’21
CoreData: warning: CoreData+CloudKit
I use NSPersistentCloudKitContainer. It seems that it the data synced in iCloud after a few seconds. However, I get the following warnings in the console. I do not understand what is it for. CoreData: warning: CoreData+CloudKit: -[NSCloudKitMirroringDelegate _performSetupRequest:]_block_invoke(813): <NSCloudKitMirroringDelegate: 0x280b051e0>: Successfully set up CloudKit integration for store: <NSSQLCore: 0x280024a00> (URL: file:///private/var/mobile/Containers/Shared/AppGroup/89D9D17C-03DF-48E4-83C3-DB23A8FE0D6F/TestData.sqlite) CoreData: warning: CoreData+CloudKit: -[NSCloudKitMirroringDelegate checkAndScheduleImportIfNecessary:]_block_invoke(2033): <NSCloudKitMirroringDelegate: 0x280b051e0>: Scheduling automated import with activity: Could you please explain what is this warning for and what should I do to fix it?
2
0
1.8k
Jul ’20
Suspicious CloudKit Telemetry Data
Starting 20th March 2025, I see an increase in bandwidth and latency for one of my CloudKit projects. I'm using NSPersistentCloudKitContainer to synchronise my data. I haven't changed any CloudKit scheme during that time but shipped an update. Since then, I reverted some changes from that update, which could have led to changes in the sync behaviour. Is anyone else seeing any issues? I would love to file a DTS and use one of my credits for that, but unfortunately, I can't because I cannot reproduce it with a demo project because I cannot travel back in time and check if it also has an increase in metrics during that time. Maybe an Apple engineer can green-light me filing a DTS request, please.
0
0
131
Apr ’25