WKWebView 注册js和移除js

/*! @abstract Adds a script message handler to the main world used by page content itself.
@param scriptMessageHandler The script message handler to add.
@param name The name of the message handler.
@discussion Calling this method is equivalent to calling addScriptMessageHandler:contentWorld:name:
with [WKContentWorld pageWorld] as the contentWorld argument.
*/

  • (void)addScriptMessageHandler:(id )scriptMessageHandler name:(NSString *)name;
    每调佣一次,webview被retain一次。
    说明这里是强引用,
    在退出的时候,必须remove掉。
    才能彻底释放掉webview.

你可能感兴趣的:(WKWebView 注册js和移除js)