I'm using a UIWebView to display a captcha. If the user enters the captcha correctly, then the server returns data using JSON serialization. I don't want the view to display this, instead I want to intercept the loads of the UIWebView, and if it returns JSON serialized data, I want to store that data and remove the UIWebView.
I was thinking of setting up a delegate to the UIWebView and use its webViewDidFinishLoad, but how do I get the content loaded?
You may want to look into defining a UIWebViewDelegate and using
webView:shouldStartLoadWithRequest:navigationType: to intercept the request and handle it.
In your case, you would evaluate the NSURLRequest and return NO to prevent the WebView from loading. In turn, you would create a separate NSURLConnection with the same request, and set up a delegate to receive the (JSON) response.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With