Post

Replies

Boosts

Views

Activity

Reply to Can't accept CloudKit share invitation from my SwiftUI application
I implemented the userDidAcceptCloudKitShareWith… in the SceneDelegate, and set up the scene delegate as such: class AppDelegate { // MARK: UISceneSession Lifecycle func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { let config = UISceneConfiguration(name: nil, sessionRole: connectingSceneSession.role) config.delegateClass = SceneDelegate.self return config } } class SceneDelegate: UIResponder, UIWindowSceneDelegate { var window: UIWindow? func windowScene(_ windowScene: UIWindowScene, userDidAcceptCloudKitShareWith cloudKitShareMetadata: CKShare.Metadata) { let acceptShareOperation = CKAcceptSharesOperation(shareMetadatas: [cloudKitShareMetadata]) acceptShareOperation.qualityOfService = .userInteractive acceptShareOperation.perShareResultBlock = { meta, result in guard let recordID = meta.hierarchicalRootRecordID else { return } // do the things… } acceptShareOperation.acceptSharesResultBlock = { result in // N/A } CKContainer(identifier: cloudKitShareMetadata.containerIdentifier).add(acceptShareOperation) } }
Aug ’24
Reply to CoreData sharing/collaboration feature is broken
I've often wondered how NSPersistentCloudKitContainer.share… works, and your example goes a long way to explaining it. When you identify the objects you want to share, they get moved to a new zone. and that zone is what is shared. but the API probably wasn't designed to handle the scenario you describe, so once a record is moved to a shared zone, it doesn't/can't get move to another zone. 2¢
Aug ’24
Reply to CoreData persistent history tracking with legacy stack and Objective C
is the question, you are building a new version of your app and want to load an existing store from an old version, and also enable history, does that work and what are the implications? My suggestion is to build a test app, define a core data schema, run the app, generate and save some test data, quit the app, enable the history bit, and launch again, does the call to load stores fail in some way? and if it succeeds, when you add new data, what does the history show?
Jul ’24