Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos NSDocument回调方法签名_Macos_Swift_Appkit_Nsdocument - Fatal编程技术网

Macos NSDocument回调方法签名

Macos NSDocument回调方法签名,macos,swift,appkit,nsdocument,Macos,Swift,Appkit,Nsdocument,我试图在Swift中的NSDocument上使用runModalSavePanelForSaveOperation方法,但在保存面板关闭时出现“无法识别的选择器发送到实例”异常。方法调用如下所示: self.runModalSavePanelForSaveOperation(.SaveOperation, delegate: self, didSaveSelector: Selector("document:didSave:contextInfo"), contextInfo: nil) 这就

我试图在Swift中的
NSDocument
上使用
runModalSavePanelForSaveOperation
方法,但在保存面板关闭时出现“无法识别的选择器发送到实例”异常。方法调用如下所示:

self.runModalSavePanelForSaveOperation(.SaveOperation, delegate: self, didSaveSelector: Selector("document:didSave:contextInfo"), contextInfo: nil)
这就是回调的样子:

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

基于一个类似的问题,看起来方法签名应该是正确的。我遗漏了什么吗?

选择器中缺少一个冒号。应该是

Selector("document:didSave:contextInfo:")

谢谢您!真不敢相信我错过了:)