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

时间:2018-05-30 13:33:50

标签: ios swift cncontactviewcontroller

此代码折叠了我的所有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

似乎没问题

这是苹果虫吗?

1 个答案:

答案 0 :(得分:1)

你应该推 CNContactViewController 而不是现在。 我建议你观看WWDC 2015关于这个问题的演讲。

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

30:00之后,您可以看到有关此问题的演示。