ShawnFoo / SwiftWebViewBridge

Swift version of WebViewJavascriptBridge with more simplified and friendly methods to handle messages between Swift and JS in UIWebViews
MIT License
137 stars 34 forks source link

when handler an unknow meth handlerName fatalError #21

Closed 419860198 closed 6 years ago

419860198 commented 6 years ago

2018-02-01 14:17:25.014586+0800 Sellers[338:53387] Fatal error: No handler for msg from JS: ["callbackId": cb_2_JS_1517465828437, "handlerName": getUnreadNum, "data": { }]..Please at least create a default handler when initializing the bridge = ): file /Users/zhangxiaobo/TFotomerchanat/Pods/SwiftWebViewBridge/SwiftWebViewBridge/SwiftWebViewBridge.swift, line 223

can you don't use fatalError?

ShawnFoo commented 6 years ago

Yep, I totally agree with you.

A typo in javascript will crash the app. That's unacceptable.

That will be changed to print debug log or only using fatalError in debug mode.

ShawnFoo commented 6 years ago

Already removed fatalError on branch develop_wkwebview