Post

Replies

Boosts

Views

Activity

CNContactViewController blocking Home gesture after presenting the "Add Photo" View Controller in iOS 17
Hello I'm currently having some issues when using CNContactViewController in iOS 17. The problem starts after embedding the CNContactViewController inside a UINavigationController and presenting it modally. The CNContactViewController is created using the forNewContact initialiser and passing an initial value to it (CNMutableContact) Next I tap the Add Photo button, which presents the new iOS 17 Photo Editor/Picker which immediately covers all the screen. After pressing Cancel, the Photo Editor is dismissed but the "Go Home" gesture is disabled and its not possible to go to the Home Screen unless the iPhone screen is turned off and on again (this fixes the issue). This seems to be a bug in this CNContactViewController unless I'm using it incorrectly. Additionally, this is only happening when the Photo Editor is cancelled/dismissed. If the whole process of picking and editing a photo is completed, this issue does not happens and the "Go Home" gesture works as usual. Here is a code sample of how CNContactViewController being used and presented: class ContactViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() let b = UIButton(type: .system) b.setTitle("Push", for: .normal) b.setTitleColor(.systemBlue, for: .normal) b.addTarget(self, action: #selector(pushAction(sender:)), for: .touchUpInside) b.translatesAutoresizingMaskIntoConstraints = false view.addSubview(b) NSLayoutConstraint.activate([ b.centerXAnchor.constraint(equalTo: view.centerXAnchor), b.centerYAnchor.constraint(equalTo: view.centerYAnchor) ]) } @objc func pushAction(sender: UIButton) { let mc = CNMutableContact() mc.givenName = "MyName" let vc = CNContactViewController(forNewContact: mc) vc.allowsActions = false vc.allowsEditing = false vc.contactStore = CNContactStore() vc.delegate = self let nc = UINavigationController(rootViewController: vc) nc.modalPresentationStyle = .fullScreen self.present(nc, animated: true) } } extension ContactViewController: CNContactViewControllerDelegate { func contactViewController(_ viewController: CNContactViewController, didCompleteWith contact: CNContact?) { viewController.dismiss(animated: true) } }
0
0
525
Mar ’24