Delegate processing to the image picker does not work.

Since the application cannot detect when the image picker is activated, it uses recursive processing to get the topmost View, and then executes the Delegate process after it is activated.
The following code is implemented in our own dialog, and detects the end of the image picker when the user selects "Select Photo".

Code Block swift
extension DataSelectViewController: UIImagePickerControllerDelegate & UINavigationControllerDelegate {
  func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
    Debug.log("image picker - taped Cancel")
/* Added my process */
    picker.dismiss(animated: true, completion: nil)
  }
  func imagePickerController(_: UIImagePickerController, didFinishPickingMediaWithInfo _: [UIImagePickerController.InfoKey: Any]) {
    Debug.log("image picker - taped Done")
    /* Added my process */
  }
}

The delegate process may not be executed.

What are the possible factors?
Delegate processing to the image picker does not work.
 
 
Q