title: Setting UIDelegate for UIWebView
body: <p>I read somewhere to read javascript console messages using the </p>
  
  <pre><code>- (void)webView:(WebView *)webView addMessageToConsole:(NSDictionary *)message
  </code></pre>
  
  <p>delegate method from the UIDelegate. But how/where do I need to set the delegate of the WebView (not the UIWebView) to my custom delegate?</p>
  
  <p>I know Apple doesn't allow this in the AppStore, but I just want to implement this for debugging purposes.</p>
  
  <p>What I tried so far:</p>
  
  <pre><code>- (void)webView:(id)sender didClearWindowObject:(id)windowObject forFrame:(WebFrame*)frame
  {
      [webView setUIDelegate:[[MyCustomUIDelegate alloc] init]];
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>-(void) webView:(id)webView windowScriptObjectAvailable:(id)newWindowScriptObject 
  {    
      [webView setUIDelegate:[[MyCustomUIDelegate alloc] init]];
  }
  </code></pre>