문제

From documentation, it seems to be possible except for the sentence highlighted :

The web scripting capabilities of WebKit permit you to access Objective-C properties and call Objective-C methods from the JavaScript scripting environment.

An important but not necessarily obvious fact about this bridge is that it does not allow any JavaScript script to access Objective-C. You cannot access Objective-C properties and methods from a web browser unless a custom plug-in has been installed. The bridge is intended for people using custom plug-ins and JavaScript environments enclosed within WebKit objects (for example, a WebView).

Or should I consider the solution from Sixten Otto shown here ? What I wish to do is : when user tap on an image in UIWebView a JavaScript routine calls a method in Objective-C.

도움이 되었습니까?

해결책

Did you see this JavaScriptFromObjC

and this question

다른 팁

Take a look at open source project Apache Cordova. You'll learn how to interact with native code for other mobile platforms, too.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top