0

I trying to use the runModalSavePanelForSaveOperation method on NSDocument in Swift, but I get an "unrecognized selector sent to instance" exception when the save panel closes. The method call looks like this:

self.runModalSavePanelForSaveOperation(.SaveOperation, delegate: self, didSaveSelector: Selector("document:didSave:contextInfo"), contextInfo: nil)

And this is what the callback looks like:

func document(document: NSDocument, didSave: Bool, contextInfo: UnsafeMutablePointer<Void>) {}

Based on this answer to a similar question it looks like the method signature should be correct. Am I missing something?

Community
  • 1
  • 1
Niels
  • 583
  • 5
  • 20

1 Answers1

0

There is one colon missing in the selector. It should be

Selector("document:didSave:contextInfo:")
Martin R
  • 529,903
  • 94
  • 1,240
  • 1,382