1

I've been trying for a week to make sharing work, using coredata, still no luck. Now I've made the simplest code to see if something works:

struct CloudKitShareView: UIViewControllerRepresentable {
    
    @ObservedObject var controller: MainViewController
    
    func makeUIViewController(context: Context) -> UICloudSharingController {
        
        let container = PersistenceController.shared.container
        
        let cloudSharingController = UICloudSharingController { controller, completion in
            container.share(self.controller.expenses, to: nil) { objectIDs, share, container, error in
                completion(share, container, error)
            }
        }

        return cloudSharingController
    }

    func updateUIViewController(
        _ uiViewController: UIViewControllerType,
        context: Context
    ) { }
}

when i call it using

.popover(isPresented: $controller.presentSharingController) {
                CloudKitShareView(controller: controller)
            }

it shows a blank screen and nothing happens, help me understand please! Thank you

Cryv
  • 31
  • 3
  • I don't have a solution for you, but I'm also struggling with UICloudSharingController when used with CoreData and CloudKit. See my question https://stackoverflow.com/questions/73888519/uicloudsharingcontroller-sharing-via-messages-broken-in-ios16 After some more digging, I am pretty sure UICloudSharingController is currently broken in iOS16, when used with Core Data + CloudKit. Please submit a bug report - I already did, at FB11623246. – blu-Fox Sep 30 '22 at 15:29
  • Yes it’s a pain in the ass.. i basically gave up for now, and i’m looking at firebase instead to see if I can achieve what i need – Cryv Oct 01 '22 at 17:09
  • Any luck here? Works on iOS 15, shows blank on iOS 16 – Grant Oganyan Nov 22 '22 at 06:12
  • No luck, I used ShareLink instead. – Cryv Nov 23 '22 at 09:05

0 Answers0