I have an iPad native application with webviews. How can I call a native function in the webview and pass some JSON data to it?
Asked
Active
Viewed 1,363 times
3
-
Do you want to call Obj-C from JS or the other way around? – Christian Schnorr Apr 18 '12 at 12:05
2 Answers
1
You need to use window.External.notify like this following blog mentions
http://www.stevesaxon.me/posts/2011/window-external-notify-in-ios-uiwebview/

Joseph Le Brech
- 6,541
- 11
- 49
- 84
0
This is a quite similar question to this one:
How to call Objective-C from Javascript?
The two more popular frameworks for doing this are JSBridge (pretty lightweight)
http://code.google.com/p/jsbridge-to-cocoa/
and to some extend PhoneGap as a much more complete solution
I used the first one for some project and I have been pretty happy with it - but maybe it requires some small adaptions because the SBJSON framework it relies on changed while JSBridge was not properly maintained in the meantime.