JavaScript not passing arguments το WindowScriptObject?

旧街凉风 提交于 2019-12-08 08:59:21

问题


First off, let me tell you that I've used webviews in Cocoa like 100 times. However, I have no clue as to what goes wrong...

Here's the JS part:

window.objc.log_("Selected Element!");

And here's the Objective-C part:

- (void)log:(NSString*)msg
{
    NSLog(@"JS: %@",msg);
}

And here's the output:

JS: (null)

What's going on?


P.S. The WebView's windowScriptObject has been correctly set and isSelectorExcludedFromWebScript: and isKeyExcludedFromWebScript: have been defined. (The function wouldn't be called at all anyway, if they weren't set...)

来源:https://stackoverflow.com/questions/26526045/javascript-not-passing-arguments-%cf%84%ce%bf-windowscriptobject

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!