I catch javascript
calls with UIWebViewDelegate
.
It looks like:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
NSDictionary *dictionary = [[[JSBridgeController alloc] init] js:request];
if (dictionary) {
if ([dictionary[@"methodName"] isEqualToString:@"gimmeUser"]) {
[self.delegate gimmeUserJS: dictionary];
}
if ([ dictionary[@"methodName"] isEqualToString:@"initMe"]) {
[self.delegate initMeJS: dictionary];
}
}
return YES;}
The problem is on the web side for me. It has dozens such JS
requests as in above code and send them asynchronous. So if I get two request same time the webview delegate can see only one of them and ignore the other one.
I tried to use NSOperationQueue
and NSURLConnection sendAsynchronousRequest
but without any success.
How could I invoke shouldStartLoadWithRequest
delegate for each async JS
request?
Thanks for any help..