我一直在试图弄清楚是什么导致了我的 iOS 应用程序中最严重的崩溃之一。看起来后台线程上发生了一些布局,导致它崩溃。有什么方法可以确定我可能在做什么来触发这个重新布局?当我的应用程序被带回前台时,我从堆栈中假设它与 UIWebView 相关。
该主题的其他stackoverflow线程似乎提到了在后台线程上触发表重新加载之类的事情。据我所知,所有的 webView 委托方法都在主线程上被调用。在某些情况下这是不正确的,或者是否有一些其他方法在后台线程上被调用而我只是不知道?
网络线程 - 崩溃。
0 WebCore _WebTryThreadLock(bool) + 297
1 WebCore _WebTryThreadLock(bool) + 288
2 WebCore WebThreadLock + 66
3 UIKit -[UIWebDocumentView(UIWebDocumentViewTextSelecting) selectionBaseWritingDirection] + 10
4 UIKit -[UITextField _currentTextAlignment] + 86
5 UIKit -[UITextField _showsClearButtonWhenNonEmpty:] + 58
6 UIKit -[UITextField _textRectForBounds:forEditing:] + 678
7 UIKit -[UITextField editingRectForBounds:] + 52
8 UIKit -[UITextField editRect] + 70
9 UIKit -[UITextField layoutSubviews] + 1320
10 UIKit -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 258
11 QuartzCore -[CALayer layoutSublayers] + 214
12 QuartzCore CA::Layer::layout_if_needed(CA::Transaction*) + 460
13 QuartzCore CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16
14 QuartzCore CA::Context::commit_transaction(CA::Transaction*) + 238
15 QuartzCore CA::Transaction::commit() + 316
16 QuartzCore CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 60
17 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
18 CoreFoundation __CFRunLoopDoObservers + 276
19 CoreFoundation CFRunLoopRunSpecific + 394
20 CoreFoundation CFRunLoopRunInMode + 104
21 WebCore RunWebThread(void*) + 444
22 libsystem_c.dylib pthread_start + 308
主线程
0 libsystem_kernel.dylib __psynch_mutexwait + 24
1 libsystem_c.dylib pthread_mutex_lock + 392
2 WebCore _WebTryThreadLock(bool) + 336
3 WebCore WebThreadLock + 66
4 WebKit -[WebDatabasePauser applicationWillEnterForeground] + 16
5 CoreFoundation _CFXNotificationPost + 1426
6 Foundation -[NSNotificationCenter postNotificationName:object:userInfo:] + 72
7 UIKit -[UIApplication _sendWillEnterForegroundCallbacks] + 154
8 UIKit -[UIApplication _handleApplicationResumeEvent:] + 1094
9 UIKit -[UIApplication handleEvent:withNewEvent:] + 1292
10 UIKit -[UIApplication sendEvent:] + 72
11 UIKit _UIApplicationHandleEvent + 6154
12 GraphicsServices _PurpleEventCallback + 590
13 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
14 CoreFoundation __CFRunLoopDoSources0 + 212
15 CoreFoundation __CFRunLoopRun + 646
16 CoreFoundation CFRunLoopRunSpecific + 356
17 CoreFoundation CFRunLoopRunInMode + 104
18 GraphicsServices GSEventRunModal + 74
19 UIKit UIApplicationMain + 1120
20 AppName main.m line 23