0

I have my URLProtocol implementation class. In my app I have there is more than one UIViewController that can do http requests (there is only one visible, but more actives). There is a way to know what instance of viewcontroller (in my URLProtocol implementation) is making the request?

Pol
  • 948
  • 1
  • 8
  • 19

1 Answers1

0

Set your view controller to be a delegate of your UIWebView (if you haven't done it already), then you can do something like this:

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
    NSLog(@"url %@", [[request URL] absoluteString]);

    // now you know which view controller made this request
    //
    // you could save this to a property in the view controller
    // or to a table of view controllers/web views 

    return YES;
}

I'm basing my answer on what I found in this very related question.

Community
  • 1
  • 1
Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215