Thursday, June 30, 2011

How to View HTML Source Code from UIWebView

While debugging a sudden Facebook iOS library defect (Blank Dialog presented), I needed to check the HTML code received from Facebook server. This is how to do it:

- (void)webViewDidFinishLoad:(UIWebView *)webView
{
   NSLog(@"%@",
    [webView stringByEvaluatingJavaScriptFromString:
    @"document.body.innerHTML"]);
}
Let's hope Facebook will quickly fix their faulty server-side code - and next time do better testing before a release...

No comments:

Post a Comment