Search results for

NSPersistentCloudKitContainer

589 results found

Post

Replies

Boosts

Views

Activity

NSCloudKitMirroringExportRequest issues
I'm attempting to create a Swift/SwiftUI app that will run on iOS/iPadOS that uses CloudKit to syncronize data between devices. I have created the App in Xcode.In the Apps Signing & Capabilities tab, I have:- Ensured that the Bundle Identifier is valid- Added the iCloud capability - Created the Container and checked it - Validated that the Container was created in the CloudKit Dashbaord- Added the Backgrouind Modes capability - Checked the Remote notifications optionI have modified/validated AppDelegate.swift:- Validated that it is using NSPersistentCloudKitContainer- Added container.viewContext.automaticallyMergesChangesFromParent to true- Added container.viewContext.mergePolicy to NSMergeByPropertyObjectTrumpMergePolicyWhen I load the App, I get a series of errors reported related to CloudKit NSCloudKitMirroringExportRequest. These errors are shown below. I am able to create records, but can see they are only stored locally and do not get synced to the CloudKit Dashboard - interestingly enough,
21
0
14k
Apr ’20
CloudKit keeps syncing after being turned off until the app is relaunched
In the following code, I'm saving and syncing objects in Core Data and CloudKit, everything is working fine, once the user creates some objects, the data starts syncing as soon as the user turns the Toggle switch On in the SettingsView. The issue I'm having is that the data continue syncing even after the switch is turned Off until I kill and relaunch the app. After relaunching the app, the data stops syncing. Any idea what could I do to make sure that the data stops syncing as soon as the toggle switch is turned off? Again, everything would work fine if the user would kill and relaunch the app right after turning it off, the data stops syncing. I thought that by calling carViewModel.updateCloudKitContainer() right after turning it off would do the trick since I'm disabling the CloudKit container by making it nil, description.cloudKitContainerOptions = nil but obviously is not enough. Core Data Manager class CoreDataManager{ // Singleton static let instance = CoreDataManager() @AppStorage(UserDefaults.Keys.iC
0
0
836
May ’23
WidgetKit doesn't fetch updated data from Core Data when WidgetCenter.shared.reloadAllTimelines() gets called
The app uses Core Data + CloudKit. When the app gets launched WidgetKit file fetches correct entries from Core Data but when I add new entries to Core Data from the main app and call WidgetCenter.shared.reloadTimelines() updated entries don't get fetched and old data is displayed inside the widget. Main app and Widget target have the same App group, iCloud capability enabled for both targets. When I call WidgetCenter.shared.reloadTimelines() from the Main app Widget reloads (timer added to Widget view sets to zero) but fetch from Core Data doesn't return newly added entries. Then I restart the app and correct entries get fetched. Why doesn't it fetch correct entries when WidgetCenter.shared.reloadTimelines() gets called and only works when app is relaunched? Widget's code: import WidgetKit import SwiftUI import CoreData struct Provider: TimelineProvider { ttfunc placeholder(in context: Context) -> HabitsEntry { ttttHabitsEntry(date: Date(), habitsCount: 0) tt} ttfunc getSnapshot(in context: Context, comple
3
0
2.9k
Nov ’20
@SectionedFetchRequest with hierarchical data structure (maybe OutlineGroup?)
I am working on a couple of Multiplatform apps that use a very similar 3 column layout - sidebar menu (or tabs for sizeClassHorizontal == .compact), with a master list under each menu option and detail view based upon master list selection. The apps use Core Data framework and NSPersistentCloudKitContainer for backup and syncing across a user's devices. The apps use Codegen = Class Definition and I write extensions for each entity to prepare convenience methods, properties, comply with generic protocol conformance. I am learning how to retrofit sectioned fetch requests into each master List. Generally this is straightforward and I'm really happy with the result. However, one particular master list is based upon an hierarchical data structure and I have investigated using the children: parameter in List to successfully create an hierarchical list. So to be clear, the following code is based upon @FetchRequest var gardens: FetchedResults (not a sectioned fetch request) and works well... extension Garde
3
0
2.2k
Nov ’21