'WebViewJavascriptBridge on iOS
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.
Solution 1:[1]
WebViewJavascriptBridge have no maintain for a long time.
Maybe you should change to use this library.
self.bridge.consolePipeBlock = ^(id _Nonnull water) {
NSLog(@"Next line is javascript console.log------>>>>");
NSLog(@"%@",water);
};
This can easy to get javascript console.log.
Also have Swift language Version.
bridge.consolePipeClosure = { water in
guard let jsConsoleLog = water else {
print("Javascript console.log give native is nil!")
return
}
print("Next line is Javascript console.log----->>>>>>>")
print(jsConsoleLog)
}
Also have h5 demo for you.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | housenkui |
