0

I'm using UIWebView's shouldStartLoadWithRequest:navigationType: delegate method to intercept html links that are executed in a web page. I am doing this so that I can receive realtime notifications from the web page. However, I'm executing about 5 web page loads in quick succession to try to receive data being passed by a custom URL scheme. I'm simply trying to log them all right now so my code looks like this:

-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
    NSLog(@"Received Request: %@", request);
    return NO;

}

However all requests are not logged via NSLog. I have confirmed that the Requests are being sent via the OSX Safari web browser's iPhone simulator logs and they do appear there.

Is there a way for me to receive all of these requests via the shouldStartLoadWithRequest: delegate method?

DavidNorman
  • 1,421
  • 1
  • 17
  • 22
  • This is intended behavior. Please see [this answer](http://stackoverflow.com/questions/15654468/uiwebviewdelegate-webviewdidfinishload-not-called-during-in-page-navigation/19841287#19841287). – Holly Nov 09 '13 at 04:36
  • Thank you for directing me to a question that has helped me Think about this a little differently. However, I'm not sure that it will solve my problem. I am not trying to get webViewDidFinishLoad to be called. I'm trying to get shouldStartLoadWithRequest: to load after every time one of my custom URL schemes is loaded. – DavidNorman Nov 12 '13 at 03:09

1 Answers1

0

I mention the other answer because it refers to Native Bridge, which can be used to pass messages between JavaScript and Objective C. Even if that is not your goal, it demonstrates the way to make your calls hit shouldLoad/didFinish methods. The technique is to add a hidden iFrame to the page, load the request in that iFrame, and the request will hit your delegate methods.

Holly
  • 5,270
  • 1
  • 24
  • 27
  • That was it, thank you for directing my attention to that solution specifically. That did solve my problem. Thank you very much! – DavidNorman Nov 13 '13 at 06:54