• How to pass an XCode variable to the HTML file

    16 June 2015

    You can construct a Javascript string then pass into -stringByEvaluatingJavaScriptFromString as show below.

    NSInteger u = get_integer_from_user();
    NSString* script = [NSString stringWithFormat:@"call_your_function(%d);", u];
    [webView stringByEvaluatingJavaScriptFromString:script];
    

    You can do something like

    [_webView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"Handler.method(%@);", variable]];

Comments

Comments closed on this post.