0

I am trying to add support for using iPhone's to scan documents into my app. When I right click in my text view I get the iPhone in the menu and I can select camera or document. When I select camera, the image is inserted into the textview automatically. When I select document, validrequestor is called and I return self for all types. The app works to there. When I select save the scan on the phone, the app crashes with;

2020-06-26 10:05:25.657246-0700 seeMyHealth[3825:106456] [General] An uncaught exception was raised

2020-06-26 10:05:25.657292-0700 seeMyHealth[3825:106456] [General] Target seeMyHealth.notesWindow returned by -[NSTextView validRequestorForSendType:returnType:] does not respond to selector readSelectionFromPasteboard:

2020-06-26 10:05:25.659379-0700 seeMyHealth[3825:106456] [General] ( 0 CoreFoundation 0x00007fff376dfbe7 __exceptionPreprocess + 250 1 libobjc.A.dylib 0x00007fff709de5bf objc_exception_throw + 48

but I have both versions for readSelection defined in my app. What gives?

  override func validRequestor(forSendType sendType: NSPasteboard.PasteboardType?, returnType: NSPasteboard.PasteboardType?) -> Any?
  {
     return self
  }

  func readSelection(from pasteboard: NSPasteboard,type: NSPasteboard.PasteboardType) -> Bool
  {
    return true
  }
  func readSelection(from pasteboard: NSPasteboard) -> Bool
  {
    return true
  }
john elemans
  • 2,578
  • 2
  • 15
  • 26

1 Answers1

1

I found it!

@objc func readSelectionFromPasteboard(_: NSPasteboard) -> Bool
{
    return true
}
danwood
  • 1,512
  • 1
  • 10
  • 27