Question

To be specific: If I want download a html-page, there are many requests to image, music, js, etc, which I cannot handle by UIWebView delegates.

To be more specific: I'm interested in handling of ajax-requests! I have tried to implement ajax-handler by injecting javascript in every loaded html-page (source: UIWebViewDelegate not monitoring XMLHttpRequest?), but this is not working (iOS 5.1.1).

I think there are solution by implementing subclass of NSURLProtocol (simple proxy), but I dont know how.

Please help!

Was it helpful?

Solution

I had to do something very similar and managed to get it working by implementing a NSURLProtocol and forcing the response to load a local json file.

You can see the full implementation here :

How to mock AJAX call with NSURLProtocol?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top