0

I met a problem.

I replaced uiwebview with WKwebview ,but how can I pass my OC Object to JS.

Can My object conform the JSContext protocol?

before

-(void)webViewDidFinishLoad:(UIWebView *)webView { [self.webView.scrollView.mj_header endRefreshing];

_jsContext = [webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
_jsContext.exceptionHandler = ^(JSContext *context, JSValue *exceptionValue) {
    context.exception = exceptionValue;
    NSLog(@"%@", exceptionValue);
};

_jsContext[@"token"] = self.token;
[self.webView stringByEvaluatingJavaScriptFromString:@"getUser()"];

}

now how can I inject the Token to JS

feelings
  • 1
  • 1

0 Answers0