【发布时间】:2015-11-06 06:21:08
【问题描述】:
我正在尝试为 NSWebView 实现一个委托,但是当我运行它时,我得到了这个错误:
TypeError: Error when calling the metaclass bases
class Delegate does not correctly implement protocol WebScripting: the signature for method isSelectorExcludedFromWebScript: is c@:: instead of Z@::
我在哪里可以找到“c@::”的文档,而不是“Z@::”,我的代码可能有什么问题?
有问题的方法如下:
def isSelectorExcludedFromWebScript_(self, sel):
return True
具体来说,NSWebView 记录在:https://developer.apple.com/library/mac/documentation/Cocoa/Reference/WebKit/Classes/WebView_Class/index.html(但我怀疑苹果将来会移动这个 URL)
更准确地说,我尝试使用的代表的非正式协议记录在此处:https://developer.apple.com/library/mac/documentation/Cocoa/Reference/WebKit/Protocols/WebFrameLoadDelegate_Protocol/index.html#//apple_ref/doc/uid/TP40003828 和 https://developer.apple.com/library/mac/documentation/Cocoa/Reference/WebKit/Protocols/WebScripting_Protocol/index.html#//apple_ref/doc/uid/TP40001562
我找到的 objc.signature 的唯一文档位于:http://pythonhosted.org/pyobjc/api/module-objc.html
【问题讨论】:
-
顺便说一句,我确实阅读了pseudofish.com/showing-a-nssavepanel-as-a-sheet.html,但是,似乎指向苹果开发文档的每个链接都已损坏。为苹果感到羞耻。
-
我可以去 here 并搜索 NSSavePanel。但是,NSWebView 没有返回任何结果,objc.signature 也没有,isSelectorExcludedFromWebScript 也没有。糟糕的搜索算法、不完整的文档或 API 发生了重大变化。
-
@BaconBits:我现在已经在问题中提供了明确的参考 - 谢谢。 :)
标签: pyobjc