Open ApesTalk opened 4 years ago
had refactor the WebViewJavascriptBridge . If you are in trouble.You can try this. Download Address: https://github.com/housenkui/WebViewJavascriptBridge More light and more simple to use. 10 mins will enough to completed your demand.
@ApesTalk
i have same issue @ApesTalk
Search "console.log("WebViewJavascriptBridge: WARNING: no handler for message from ObjC:", message);" inside WebViewJavascriptBridge_JS.m and modify JS code like this:
if (!handler) {
console.log("WebViewJavascriptBridge: WARNING: no handler for message from ObjC:", message);
if (message.callbackId) {
var callbackResponseId = message.callbackId;
_doSend({ handlerName:"", responseId:callbackResponseId, responseData:{"error": "jsHandlerNotFound"} });
}
}
This change require you provide a responseCallback or you cannot receive error callback
When i use WKWebViewJavascriptBridge call js method from iOS like this:
If sometimes the js method does not exist, i can not get any callback to know there is something wrong. If I can get feedback, I can do some default processing.