handleGetURLEvent:withReplyEvent: 在 AppDelegate 中被 KVO 遮挡?
我在尝试向我的 Mac 应用程序添加自定义 URL 支持时遇到一个奇怪的问题。我已经在 Info.plist 中定义了 URL,当我导航到它们时,我的应用程序将启动(或者,如果正在运行,则激活),但是,无论我的应用程序委托是否实现了 handleGetURLEvent:withReplyEvent: ,我在调试输出中看到以下几条消息:
+[NSKVONotifying_MyAppDelegate handleGetURLEvent:withReplyEvent:]: unrecognized selector sent to class 0x1d096e0
显然,NSKVONotifying_MyAppDelegate 是 KVO 为我的真实委托(称为 MyAppDelegate)创建的包装器,这似乎掩盖了我的实现handleGetURLEvent:withReplyEvent:,它永远不会被调用。 AFAICT,我的应用程序中没有任何内容在委托上使用 KVO,并且我对于可能导致此问题的原因已经没有想法了。
有什么建议吗?
i'm seeing a weird issue trying to add custom URL support to my Mac app. i've defined the URL(s) in Info.plist, and when i navigate to them my app gets launched (or, if running, activated), but then, regardless of whether my app delegate implements handleGetURLEvent:withReplyEvent: or not, i see a couple of the following messages in the debug output:
+[NSKVONotifying_MyAppDelegate handleGetURLEvent:withReplyEvent:]: unrecognized selector sent to class 0x1d096e0
Apparently, NSKVONotifying_MyAppDelegate is a wrapper created by KVO for my real delegate (called MyAppDelegate), and that seems to obscure my implementation of handleGetURLEvent:withReplyEvent:, which never gets called. AFAICT, nothing in my app uses KVO on the delegate, and i'm running out of ideas as to what could be causing this.
any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,KVO 的事情只是转移了注意力。该方法需要是静态的,因为仔细阅读错误消息(或文档)会清楚地表明,而我有一个实例方法(正如人们所期望的,对于委托方法?奇怪的 API 设计选择)。
turns out the KVO thing was a red herring. the method needs to be static, as careful reading of the error message (or docs) would have made clear, while i had an instance method (as one would expect, for delegate methods? weird API design choice).