wendux / DSBridge-IOS

:earth_asia: A modern cross-platform JavaScript bridge, through which you can invoke each other's functions synchronously or asynchronously between JavaScript and native.
1.96k stars 305 forks source link

runJavaScriptTextInputPanelWithPrompt 在iOS8和iOS9上出现crash,不知道什么原因 #89

Open John-yuxin opened 5 years ago

John-yuxin commented 5 years ago

image

John-yuxin commented 5 years ago

image

sunqingquan commented 5 years ago

我也遇到同样的问题,请问楼主怎么解决,我把crash日志贴在下面。

Date/Time:       2019-04-10T05:56:45Z
OS Version:      iPhone OS 12.1.4 (16D57)
Report Version:  104

Exception Type:  SIGTRAP
Exception Codes: #0 at 0x1cfd2bcb0
Crashed Thread:  0

Thread 0 Crashed:
0   CoreFoundation                       0x00000001cfd2bcb0 <redacted>   136
1   CoreFoundation                       0x00000001cfd23618 <redacted>   992
2   CoreFoundation                       0x00000001cfd2546c _CF_forwarding_prep_0   92
3   Foundation                           0x00000001d07079a0 <redacted>   100
4   Foundation                           0x00000001d08524f0 <redacted>   112
5   CoreFoundation                       0x00000001cfc03e1c <redacted>   232
6   Foundation                           0x00000001d0707a04 <redacted>   200
7   dsBridge                             0x00000001073cff6c +[JSBUtil objToJsonString:] (JSBUtil.m:18)
8   dsBridge                             0x00000001073ce668 -[DWKWebView call::] (DWKWebView.m:323)
9   dsBridge                             0x00000001073ccdb0 -[DWKWebView webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:completionHandler:] (DWKWebView.m:0)
10  WebKit                               0x00000001df832410 <redacted>   416
11  WebKit                               0x00000001df933100 <redacted>   200
12  WebKit                               0x00000001df957950 <redacted>   192
13  WebKit                               0x00000001df73a668 <redacted>   128
14  WebKit                               0x00000001df9b7b44 <redacted>   36
15  WebKit                               0x00000001df6ffa2c <redacted>   196
16  WebKit                               0x00000001df6fcc74 <redacted>   140
17  WebKit                               0x00000001df6ff428 <redacted>   752
18  JavaScriptCore                       0x00000001d703a99c <redacted>   276
19  JavaScriptCore                       0x00000001d703ac64 <redacted>   36
20  CoreFoundation                       0x00000001cfcae0e0 <redacted>   24
21  CoreFoundation                       0x00000001cfcae060 <redacted>   88
22  CoreFoundation                       0x00000001cfcad944 <redacted>   176
23  CoreFoundation                       0x00000001cfca8810 <redacted>   1040
24  CoreFoundation                       0x00000001cfca80e0 CFRunLoopRunSpecific   436
25  GraphicsServices                     0x00000001d1f21584 GSEventRunModal   100
26  UIKitCore                            0x00000001fcef8c00 UIApplicationMain   212
27  T3Go                                 0x0000000104235b10 main (AppDelegate.swift:32)
28  libdyld.dylib                        0x00000001cf766bb4 <redacted>   4

Thread 0 crashed with ARM-64 Thread State:
    pc: 0x00000001cfd2bcb0     fp: 0x000000016bbd22c0     sp: 0x000000016bbd22b0     x0: 0xe000000000000000 
    x1: 0x0000000000000000     x2: 0x0000000209a66bc0     x3: 0x0000000000000001     x4: 0x0000000000000001 
    x5: 0x0000000000000001     x6: 0x0000000000000000     x7: 0x0000000000000000     x8: 0x0a202c6773a68dce 
    x9: 0x0000000000000000    x10: 0x000fffffffffffff    x11: 0x0000000000000000    x12: 0x0000000000000000 
   x13: 0x0000000000000000    x14: 0x00000000000000e0    x15: 0x000000000000002d    x16: 0x00000001cf8fa3d4 
   x17: 0x00000001cfd25410    x18: 0x0000000000000000    x19: 0x00a202c6773a68dc    x20: 0xe000000000000000 
   x21: 0x00000001fd43f880    x22: 0x00000001fd43f880    x23: 0x0000000000000001    x24: 0x0000000000000000 
   x25: 0x0000000000000001    x26: 0x0000000209a6e000    x27: 0x0000000000000000    x28: 0x0000000283d4a560 
    lr: 0x00000001cfd23618   cpsr: 0x0000000020000000 
sunqingquan commented 5 years ago

补充一下,我这边出现的这个crash多出现在12系统以上, 我测试 10系统问题不大,请问作者有解决方案吗

wendux commented 5 years ago

Api签名是是对的吗?请根据文档检查一下,尤其是类型。

qqq1010440810 commented 5 years ago

请问你的问题解决了么,如何解决的,我现在也遇到了这个问题,web调用原生方法的时候,崩溃,在call方法里

YiFan-Tong commented 4 years ago

我遇到了相同的问题,崩溃在-(NSString *)call:(NSString*) method :(NSString*) argStr方法的ret=action(JavascriptInterfaceObject,sel,arg);这边,参照了#74 修改了我自定义的方法,之前是返回void,现在修改成下面的,就可以了:

- (NSString *)startWork:(NSDictionary *) args {
*******
return nil;
}

在中文文档中,Object-C API 签名那块,有解说,

同步API (id) handler:(id) msg

参数可以是任何类型, 但是返回值类型不能为 void。 如果不需要参数,也必须声明,声明后不使用就行。

如果同步API返回值类型为void,调用时则会导致Crash,请务必遵守签名规范。