I am using a WebView in my application and it the page I am loading has some existing javascript function calls that were used in a windows environment and should now be used in a mac application. My issue is that the current javascript (ported from a windows app where the following works) function calls objective C like this:
function callObjectiveC
{
window.external.MY_ObjectiveCFunction();
}
I have been trying to use:
+ (NSString *)webScriptNameForSelector:(SEL)sel
{
if (sel == @selector(MyObjectiveCFunction))
{
return @"My_ObjectiveCFunction";
}
}
based on: https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/WebKit/Protocols/WebScripting_Protocol/Reference/Reference.html but to no avail. Is there a way to do this? I can call the objective C method whatever I want I just need to be able to map that to what is in the existing javascript.
Thanks,
c.
Figured out a solution: