

Call ObjectiveC methods from Javascript in a UIWebView - frr149
http://maniacdev.com/2011/09/open-source-library-for-easily-communicating-with-objective-c-code-from-a-uiwebview/

======
buddydvd
Very similar code exists within PhoneGap. In addition to bi-directional
message passing, PhoneGap also provides: 1.) JSON
serialization/deserialization, 2.) callback tracking, and 3.) white-listing of
domains that may pass messages to the host.

<https://github.com/phonegap/phonegap-iphone>

------
DenisM
Here's the relevant part:

[https://github.com/marcuswestin/WebViewJavascriptBridge/blob...](https://github.com/marcuswestin/WebViewJavascriptBridge/blob/master/WebViewJavascriptBridge/Classes/WebViewJavascriptBridge.m)

------
DenisM
Any thoughts on using local XMLHttpRequest instead of the more usual frame
reload method?

~~~
marcuswestin
Great idea! Sounds cleaner but I think it'd be more code injected into the
webview than the current approach.

