Calling Javascript using UIWebView

Simple: You try to execute the JS function from Objective-C before the page even has been loaded.

Implement the UIWebView’s delegate method webViewDidFinishLoad: in your UIViewController and in there you call [graphView stringByEvaluatingJavaScriptFromString:@"methodName()"]; to make sure the function gets called after the page has been loaded.

Leave a Comment