CNContactViewController forUnknownContact 的呈现打破了视图控制器层次结构

Presenting of CNContactViewController forUnknownContact breaks view controller hierarchy

此代码折叠了我所有的 UIViewController 层次结构

func openVCard(for cnContact: CNContact) {
        let contactViewController = CNContactViewController(forUnknownContact: cnContact)
        contactViewController.contactStore = CNContactStore()
        contactViewController.delegate = self

        let navigationController = UINavigationController(rootViewController: contactViewController)
        let doneButton = UIBarButtonItem(title: "Close", style: .done, target: nil, action: nil)
        let flexibleSpaceButton = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
        contactViewController.setToolbarItems([flexibleSpaceButton, doneButton, flexibleSpaceButton], animated: false)

        navigationController.isToolbarHidden = false
        contactViewController.edgesForExtendedLayout = []

        present(viewController: navigationController, animated: true, completion: nil)
    }

CNContactViewController(forNewContact

似乎还可以

这是 Apple 的错误吗?

您应该按 CNContactViewController 而不是显示。 我建议您观看有关此问题的 WWDC 2015 演示文稿。

https://developer.apple.com/videos/play/wwdc2015/223/

在30:00之后你可以看到关于这个问题的演示。