0

I am displaying a simple HTML page inside the UIWebView. The page contains the login and password text box. When I click the login button I pass that information (username and password) using post to some URL.

I have breakpoints inside the UIWebView shouldStartLoadWithRequest method but I only see the original login page URL and not the one that it posted. When I use Charles (Network debugging) tool it shows that the POST parameters were passed to the correct URL but that request was never captured inside the shouldStartLoadWithRequest method.

How can I access the parameters inside the UIWebView so I can perform some other action?

san
  • 3,350
  • 1
  • 28
  • 40
john doe
  • 9,220
  • 23
  • 91
  • 167

1 Answers1

1

In the shouldStartLoadWithRequest delegate method, you can capture the POST body of the request. See code below:

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {

    NSLog(@"BODY: %@",[[[NSString alloc]initWithData:request.HTTPBody encoding:NSUTF8StringEncoding] autorelease]);

}
san
  • 3,350
  • 1
  • 28
  • 40