从原生控制器返回 Flutter 应用

Go back to Flutter app from native controller

我正在 iOS 从我的本地端打开新的联系人屏幕:

let contact = CNMutableContact.init()
let controller = CNContactViewController.init(forNewContact:contact)
controller.delegate = self
DispatchQueue.main.async {
    let navigation = UINavigationController .init(rootViewController: controller)
    let viewController : UIViewController? = UIApplication.shared.delegate?.window??.rootViewController
    viewController?.present(navigation, animated:true, completion: nil)
}

屏幕正常打开,问题是无法返回Flutter应用。有一个取消按钮,但是当我点击它时没有任何反应。

如何从本地控制器返回?

如何解决此问题:添加以下方法 class(已从 CNContactViewControllerDelegate 扩展:

public func contactViewController(_ viewController: CNContactViewController, didCompleteWith contact: CNContact?) {
    viewController.dismiss(animated: true, completion: nil)
}