委托连接在Cocoa

编程入门 行业动态 更新时间:2024-10-26 22:17:46
委托连接在Cocoa-Applescript中接收shouldStartLoadWithRequest?(Delegate hookup to receive shouldStartLoadWithRequest in Cocoa-Applescript?)

我正在尝试从applescript / objective-c OSX应用程序中的WebView接收shouldStartLoadWithRequest消息。

我希望收到的消息:

on webView_shouldStartLoadWithRequest_(request, navigation_type) log "should start!" return yes end webView_shouldStartLoadWithRequest_

我被引导相信我在IntefaceBuilder中有错误的委托连接,但我已经尝试了所有看似合理且仍然没有运气的东西。

downloadDelegate --> MyApp App Delegate frameLoadDelegate --> MyApp App Delegate resourceLoadDelegate --> MyApp App Delegate UIDelegate --> MyApp App Delegate

到目前为止没有运气。 但是,我有其他消息正常工作(例如webView_didStartProvisionalLoadForFrame_工作正常)。

连接或添加以接收此事件需要什么? 我对这种类型的编程很新,所以如果我遗漏了一些明显的东西,我会道歉。

非常感谢!

I'm trying to receive the shouldStartLoadWithRequest message from a WebView in an applescript/objective-c OSX application.

The applescript I would like to receive the message with:

on webView_shouldStartLoadWithRequest_(request, navigation_type) log "should start!" return yes end webView_shouldStartLoadWithRequest_

I am led to believe that I have the wrong delegate connections in the IntefaceBuilder, but I've tried everything which looks plausible and still no luck.

downloadDelegate --> MyApp App Delegate frameLoadDelegate --> MyApp App Delegate resourceLoadDelegate --> MyApp App Delegate UIDelegate --> MyApp App Delegate

No luck so far. However, I have other messages working correctly (e.g. webView_didStartProvisionalLoadForFrame_ works fine).

What do I need to connect or add to receive this event? I'm very new to this type of programming, so apologies if I'm missing something obvious.

Thanks so much!

最满意答案

您可能正在做的一切正确,但由于没有发送消息,因此未收到消息。 webView:shouldStartLoadWithRequest:不是OS X上任何Web视图委托协议中的方法。(它确实存在于iOS上 。)

我根本不熟悉那些各种委托协议 ,但是根据你想要完成的任务,似乎webView:resource:willSendRequest:redirectResponse:fromDataSource:或者webView:decidePolicyForNavigationAction:request:frame:decisionListener:可能有用。

You're probably doing everything right, but the message isn't being received because it isn't being sent. webView:shouldStartLoadWithRequest: is not a method in any web view delegate protocol on OS X. (It does exist on iOS.)

I'm not at all familiar with those various delegate protocols, but depending on what you're trying to accomplish, it seems that either webView:resource:willSendRequest:redirectResponse:fromDataSource: or possibly webView:decidePolicyForNavigationAction:request:frame:decisionListener: may be useful.

更多推荐

本文发布于:2023-08-04 07:13:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1413177.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Cocoa

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!