我在其中初始化一个WebView
+(void)initialize {}函数,但有时会崩溃。该日志报告了BUS_ADRALN错误,我还猜想backTrace可能完全混乱并试图获得正确的结果,结果仍然显示此崩溃与webView有关。
我正在网上搜索很长时间。但是没用。请提供帮助或尝试提供一些实现方法的建议。
有代码和崩溃文件:
+ (void)initialize{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
[ONEFusionWebView setFusionUserAgent];
});
}
+ (void)setFusionUserAgent
{
UIWebView *tempWebView = [[UIWebView alloc] initWithFrame:CGRectZero];
NSString *userAgent = [tempWebView stringByEvaluatingJavaScriptFromString:@"navigator.userAgent"];
}
崩溃日志:
Incident Identifier: FFFBCFC7-BF94-4AF0-90AF-06E77D5BBD89
CrashReporter Key: iHGOhK4GQJWsvckILqclKw
Hardware Model: iPhone8,1
Version: 7.1.20 (7.1.20.911271916)
Code Type: ARM-64
Parent Process: ??? [1]
Date/Time: 2018-12-05T21:32:24Z
Launch Time: 2018-12-05T21:32:23Z
OS Version: iPhone OS 12.1 (16B92)
Report Version: 104
Exception Type: SIGBUS
Exception Codes: BUS_ADRALN at 0x1a0354130
Crashed Thread: 0
Thread 0 Crashed:
0 WebCore 0x1a1686d78 0x1a034b000 + 20168056
1 WebCore 0x1a16853b8 0x1a034b000 + 20161464
2 WebCore 0x1a1684d24 0x1a034b000 + 20159780
3 WebCore 0x1a16551ec 0x1a034b000 + 19964396
4 WebCore 0x1a164374c 0x1a034b000 + 19892044
5 WebCore 0x1a165761c 0x1a034b000 + 19973660
6 WebCore 0x1a16564f0 0x1a034b000 + 19969264
7 WebCore 0x1a16554e4 0x1a034b000 + 19965156
8 WebCore 0x1a164374c 0x1a034b000 + 19892044
9 WebCore 0x1a1799ef0 0x1a034b000 + 21294832
10 WebCore 0x1a13deac8 0x1a034b000 + 17382088
11 WebCore 0x1a13ea558 0x1a034b000 + 17429848
12 WebKitLegacy 0x1a1beebd8 0x1a1beb000 + -[WebView(WebPrivate) _synchronizeCustomFixedPositionLayoutRect]
13 UIKitCore 0x1c4f87e9c 0x1c41ad000 + -[UIWebDocumentView _updateFixedPositionedObjectsLayoutRectUsingWebThread:synchronize:]
14 UIKitCore 0x1c4f835d4 0x1c41ad000 + -[UIWebDocumentView viewportHandler:didChangeViewportSize:]
15 UIKitCore 0x1c4fbe4a0 0x1c41ad000 + -[_UIWebViewportHandler update:]
16 UIKitCore 0x1c4f83888 0x1c41ad000 + -[UIWebDocumentView _setDocumentType:overrideCustomConfigurations:viewportArguments:]
17 UIKitCore 0x1c4fb2a20 0x1c41ad000 + -[UIWebView _webViewCommonInitWithWebView:scalesPageToFit:]
18 UIKitCore 0x1c4fb2d70 0x1c41ad000 + -[UIWebView initWithFrame:]
19 GlobalPax 0x102e70c84 0x102410000 + +[ONEFusionWebView setFusionUserAgent] ONEFusionWebView.m:68
20 libdispatch.dylib 0x19744a484 0x1973e9000 + __dispatch_client_callout
21 libdispatch.dylib 0x1973ec6d8 0x1973e9000 + __dispatch_once_callout
22 libobjc.A.dylib 0x196bdd024 0x196bdb000 + _CALLING_SOME_+initialize_METHOD
23 libobjc.A.dylib 0x196be2f84 0x196bdb000 + __class_initialize
24 libobjc.A.dylib 0x196bec8f8 0x196bdb000 + _lookUpImpOrForward
25 libobjc.A.dylib 0x196bf9098 0x196bdb000 + __objc_msgSend_uncached
26 libdispatch.dylib 0x1974496c8 0x1973e9000 + __dispatch_call_block_and_release
27 libdispatch.dylib 0x19744a484 0x1973e9000 + __dispatch_client_callout
28 libdispatch.dylib 0x1973f69b4 0x1973e9000 + __dispatch_main_queue_callback_4CF$VARIANT$mp
29 CoreFoundation 0x19799fdd0 0x1978f4000 + ___CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
30 CoreFoundation 0x19799ac98 0x1978f4000 + ___CFRunLoopRun
31 CoreFoundation 0x19799a1cc 0x1978f4000 + _CFRunLoopRunSpecific
32 GraphicsServices 0x199c11584 0x199c06000 + _GSEventRunModal
33 UIKitCore 0x1c4a95054 0x1c41ad000 + _UIApplicationMain
34 GlobalPax 0x1024140c8 0x102410000 + main main.m:14
35 libdyld.dylib 0x19745abb4 0x19745a000 + _start