marcuswestin / WebViewJavascriptBridge

An iOS/OSX bridge for sending messages between Obj-C and JavaScript in UIWebViews/WebViews
http://marcuswest.in
MIT License
14.29k stars 2.98k forks source link

About jsbridge reports an error when JS passes jsplainobject to OC #376

Open llqqww123 opened 5 years ago

llqqww123 commented 5 years ago

Whenever JS passes jsplainobject to OC, the console reports the following error:

WebViewJavascriptBridge: WARNING: Error when trying to fetch data from WKWebView: Error Domain=WKErrorDomain Code=4 "A JavaScript exception occurred" UserInfo={WKJavaScriptExceptionLineNumber=1, WKJavaScriptExceptionMessage=TypeError: JSON.stringify cannot serialize cyclic structures., WKJavaScriptExceptionColumnNumber=1523, WKJavaScriptExceptionSourceURL=http://mobile3.nstc.com.cn/sxcc/mobile/#account-balance-and-details, NSLocalizedDescription=A JavaScript exception occurred}。

WebViewError:

WebViewJavascriptBridge: WARNING: ObjC got nil while fetching the message queue JSON from webview. This can happen if the WebViewJavascriptBridge JS is not currently present in the webview, e.g if the webview just loaded a new page.

So,If the JS side does not handle, if the problem is fixed?

Cheers, @marcuswestin

housenkui commented 5 years ago

It seem that Javascript have Cross domain operation. And the other doman don't register method correctly. Also please check the 'data' why that Javascript can't stringify?