1

Subclassing NSURLProtocol and NSURLCache appear to be two established approaches to allowing JavaScript communication from a UIWebView to native iOS code.

Both allow you to intercept NSURLRequests made by a UIWebView and return arbitrary response data.

Both techniques have performance sufficient for my requirements.

So, performance time aside, is there any reason why I should prefer one approach over the other?

For reference an example using NSURLProtocol and an example using NSURLCache:

iOS WebView remote html with local image files

http://www.handcraftedsoftware.net/articles/how-to-pass-messages-between-native-ios-and-a-uiwebview-via-ajax-without-phonegap

Community
  • 1
  • 1
user1173706
  • 2,612
  • 3
  • 19
  • 29

0 Answers0