So I’m creating an app in which there’s a UIWebView which shows a list of locations. My goal is to make it possible that once the user clicks one of the locations, my app can get the lat and longitude of the spot and therefore launch an integrated Navigation SDK. My point is how do I get and pass the location values from the webView to my Objective-C code? I’m using WebViewJavascriptBridge.
Advertisement
Answer
You can set the hyperlinks on the locations.
For example: <a href="location1,latitude=21,longitude=22" id="location1" >Location1</a>
Once this Location1
gets clicked, - webView:shouldStartLoadWithRequest:navigationType:
method will be called, and you can extract value of latitude and longitude