UIDocumentInteractionController crashes caught by Exception Breakpoint
-
07-07-2021 - |
Question
I am using the UIDocumentInteractionController to preview pdf files. I display the controller as follows:
self.docInteractionController = [UIDocumentInteractionController interactionControllerWithURL:pdfUrl];
self.docInteractionController.delegate = self;
self.docInteractionController.name = literature.title;
[self.docInteractionController presentPreviewAnimated:YES];
It all works a treat. However, if I add an Exception Breakpoint catch-all to Xcode and debug the app then I notice quite a few crashes happening as I interact with the pdf document. The app does not crash totally, but the exception breakpoint fires whenever I tap on the document.
Do I need to worry about this behaviour?
Solution
If you are not retaining the UIDocumentInteractionController Object thats when you will see a crash. Try to retain self.docInteractionController. I too ran into the same problem and this fixed it.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow