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