I am trying to disable UIMenuItems in PDFKit. I have implemented
override func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool {
return false
}
But MenuItems Copy and Select All are still active. The main reason I want to disable them is because Select All causes fatal memory errors on larger pdf documents.
malloc: can't allocate region
I have submitted a bug report, but in the meantime I need to disable the menu item.
Note: if pdfDocument.string is large enough, any of the below calls will cause a crash.
- pdfView.selectAll()
- UIMenuController.selectAll
- let string = pdfDocument.string