1

I am working on calling javascript function from objective C. I have a function like this:

var ABC = {
    testingFunctionA : function() {
        alert("Testing ABC!");
        return "Hi";
    },

    testingFunctionB : function() {
        alert("Testing 123!");
        return "Hello";
    } };

I tried to call the function with this method, but its failed.

NSString *function = [[NSString alloc] initWithFormat: @"ABC.testingFunctionA()"];

NSString *result = [theWebView stringByEvaluatingJavaScriptFromString:function];

NSLog(@"returnValue = %@ ",result);

Anyone know the correct way to call the function?

LYS
  • 51
  • 3

0 Answers0