How to call Objective-C from Javascript?

前端 未结 8 1705
误落风尘
误落风尘 2020-11-22 17:38

I have a WebView, and I want to call a view in Objective-C from JavaScript. Does someone know how I can do this?


I have this code in my ViewController:

8条回答
  •  星月不相逢
    2020-11-22 17:47

    Assuming you're doing an app, you can look at how PhoneGap implements that (or even use it). It's a library that supports back-and-forth communication between JS and OBJ-C. There are other libraries and solutions, as well.

    If you're talking about a web app (something the user gets to from Mobile Safari), you can't get to Objective-C from there.

提交回复
热议问题