UIWebView stringByEvaluatingJavaScriptFromString
问题 I'm stuck on getting some pretty basic JS to run in my UIWebView. In the web view's delegate, I have : - (void)webViewDidFinishLoad:(UIWebView *)wView { NSString *someHTML = [wView stringByEvaluatingJavaScriptFromString:@"document.getElementsByClassName('box')[0]"]; NSString *allHTML = [wView stringByEvaluatingJavaScriptFromString:@"document.body.innerHTML"]; NSLog(@"someHTML: %@", someHTML); NSLog(@"allHTML: %@", allHTML); } but when the method is invoked, someHTML is nil while allHTML