Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

你好 不能完全适配,比如与js交互问题 #27

Open
MoShenGuo opened this issue Mar 24, 2020 · 5 comments
Open

你好 不能完全适配,比如与js交互问题 #27

MoShenGuo opened this issue Mar 24, 2020 · 5 comments

Comments

@MoShenGuo
Copy link

你好 不能完全适配,比如与js交互问题,uiwebView有jscontext来注册js回来调用方法,但是wkwebView没有 这个怎么处理呢

@li6185377
Copy link
Owner

/*! @abstract Adds a script message handler.
@param scriptMessageHandler The message handler to add.
@param name The name of the message handler.
@discussion Adding a scriptMessageHandler adds a function
window.webkit.messageHandlers..postMessage() for all
frames.
*/

  • (void)addScriptMessageHandler:(id )scriptMessageHandler name:(NSString *)name;

@MoShenGuo
Copy link
Author

我看你里面没有使用这个方法的 也是用了context来的,没有这方法处理

@MoShenGuo
Copy link
Author

addScriptMessageHandler:(id )scriptMessageHandler name:(NSString *)name;用这个方法的话,
//拦截执行网页中的JS方法

  • (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message js调用原生需要回调这个代理方法,我看你这个代理没有实现

@li6185377
Copy link
Owner

这个要你自己添加的

@MoShenGuo
Copy link
Author


还有一个为什么我设置wkwebView,为什么我断点wkwebView的代理方法没有断点到呢?
image
这是什么原因
这些代理方法都没有走,是什么原因呢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants