Post

Replies

Boosts

Views

Activity

UIDocumentInteractionController - delegate methods will not be called
Hello, we are presenting a UIDocumentInteractionController within our app, so the user can share some documents. Sharing basically works but we are facing the problem that the two delegate methods documentInteractionController(UIDocumentInteractionController, willBeginSendingToApplication: String?) and documentInteractionController(UIDocumentInteractionController, didEndSendingToApplication: String?) are never being called. Other delegate methods such as documentInteractionControllerWillBeginPreview(UIDocumentInteractionController) are called just fine. Everything worked as expected when we last checked a year ago or so, but doesn't anymore now, even after updating to the latest iOS 18.3. Does anybody know of a solution for this? For reference, this is the simplified code we are using the reproduce the issue: import UIKit import OSLog class ViewController: UIViewController, UIDocumentInteractionControllerDelegate { let log = Logger(subsystem: "com.me.pdfshare", category: "app") var documentInteractionController: UIDocumentInteractionController! override func viewDidLoad() { super.viewDidLoad() guard let pdfURL = Bundle.main.url(forResource: "test", withExtension: "pdf") else { return } documentInteractionController = UIDocumentInteractionController(url: pdfURL) documentInteractionController.delegate = self documentInteractionController.presentPreview(animated: true) } // MARK: - UIDocumentInteractionControllerDelegate func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController { log.notice("documentInteractionControllerViewControllerForPreview") return self } // This will be called. func documentInteractionController(_ controller: UIDocumentInteractionController, willBeginSendingToApplication application: String?) { log.notice("willBeginSendingToApplication") } // This will NOT be called. func documentInteractionController(_ controller: UIDocumentInteractionController, didEndSendingToApplication application: String?) { log.notice("didEndSendingToApplication") } // This will NOT be called. }
Topic: UI Frameworks SubTopic: UIKit Tags:
4
0
577
Mar ’25