我正在尝试从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 DelegateNo 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.
更多推荐
发布评论