Error creating the CFMessagePort needed to communicate with PPT Error creating the CFMessagePort needed to communicate with PPT ios ios

Error creating the CFMessagePort needed to communicate with PPT


I wrote a workaround using a hosting UINavigationController and here is my code:

import SwiftUIimport ContactsUIstruct ContactPickerView: UIViewControllerRepresentable {        @Environment(\.presentationMode) var presentationMode        func makeUIViewController(context: Context) -> UINavigationController {        let navController = UINavigationController()        let controller = CNContactPickerViewController()        controller.delegate = context.coordinator        navController.present(controller, animated: false, completion: nil)        return navController    }        func updateUIViewController(_ uiViewController: UINavigationController, context: Context) {        print("Updating the contacts controller!")    }        // MARK: ViewController Representable delegate methods    func makeCoordinator() -> ContactsCoordinator {        return ContactsCoordinator(self)    }        class ContactsCoordinator : NSObject, UINavigationControllerDelegate, CNContactPickerDelegate {        let parent: ContactPickerView        public init(_ parent: ContactPickerView) {            self.parent = parent        }                func contactPickerDidCancel(_ picker: CNContactPickerViewController) {            print("Contact picked cancelled!")            parent.presentationMode.wrappedValue.dismiss()        }                func contactPicker(_ picker: CNContactPickerViewController, didSelect contact: CNContact) {            print("Selected a contact")            parent.presentationMode.wrappedValue.dismiss()        }    }}

And I use it like:

Button("Select a contact") {       openSelectContact.toggle()} .sheet(isPresented: $openSelectContact, onDismiss: nil) {       ContactPickerView()     }


matomo