2015-02-24 49 views
0

沒有得到爲什麼應用程序崩潰的隨機時間。無法找到任何str。請幫助..我無法通過此日誌跟蹤問題。還請幫助我如何處理這種難以記錄的問題,以便跟蹤問題出在哪裏。如何處理終止應用程序由於未捕獲的異常

Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSSetM: 0x7fda3c871090> was mutated while being enumerated.' 
*** First throw call stack: 
(
    0 CoreFoundation      0x0000000105ed1f35 __exceptionPreprocess + 165 
    1 libobjc.A.dylib      0x0000000104ce1bb7 objc_exception_throw + 45 
    2 CoreFoundation      0x0000000105ed1894 __NSFastEnumerationMutationHandler + 132 
    3 Foundation       0x000000010488e3be -[NSISEngine _coreReplaceMarker:withMarkerPlusDelta:] + 347 
    4 Foundation       0x000000010488e1dc -[NSISEngine constraintDidChangeSuchThatMarker:shouldBeReplacedByMarkerPlusDelta:] + 239 
    5 Foundation       0x000000010488adea -[NSLayoutConstraint _containerGeometryDidChange] + 310 
    6 UIKit        0x0000000103c03a04 ___UITagLayoutConstraintsForConstantChangeForSelectedAttributes_block_invoke + 409 
    7 UIKit        0x0000000103c1027b -[UIView(AdditionalLayoutSupport) _withUnsatisfiableConstraintsLoggingSuspendedIfEngineDelegateExists:] + 115 
    8 UIKit        0x0000000103c03865 _UITagLayoutConstraintsForConstantChangeForSelectedAttributes + 80 
    9 UIKit        0x00000001035ea079 -[UIView _layoutMarginsDidChange] + 60 
    10 UIKit        0x00000001035ea248 -[UIView setLayoutMargins:] + 426 
    11 UIKit        0x00000001036a9296 -[UIViewController _setContentOverlayInsets:] + 270 
    12 UIKit        0x00000001036a9bc7 -[UIViewController _updateContentOverlayInsetsFromParentIfNecessary] + 1857 
    13 UIKit        0x00000001036038cd -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355 
    14 QuartzCore       0x0000000109d9dde8 -[CALayer layoutSublayers] + 150 
    15 QuartzCore       0x0000000109d92a0e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380 
    16 QuartzCore       0x0000000109d9287e _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24 
    17 QuartzCore       0x0000000109d0063e _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 242 
    18 QuartzCore       0x0000000109d0174a _ZN2CA11Transaction6commitEv + 390 
    19 UIKit        0x000000010358714d _UIApplicationHandleEventQueue + 2035 
    20 CoreFoundation      0x0000000105e07551 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 
    21 CoreFoundation      0x0000000105dfd41d __CFRunLoopDoSources0 + 269 
    22 CoreFoundation      0x0000000105dfca54 __CFRunLoopRun + 868 
    23 CoreFoundation      0x0000000105dfc486 CFRunLoopRunSpecific + 470 
    24 GraphicsServices     0x0000000107a659f0 GSEventRunModal + 161 
    25 UIKit        0x000000010358a420 UIApplicationMain + 1282 
    26 HomeDiary       0x0000000102c861c3 main + 115 
    27 libdyld.dylib      0x0000000106fa5145 start + 1 
) 
libc++abi.dylib: terminating with uncaught exception of type NSException 
(lldb) bt 
* thread #1: tid = 0x1f5db, 0x00000001072c3286 libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT 
    frame #0: 0x00000001072c3286 libsystem_kernel.dylib`__pthread_kill + 10 
    frame #1: 0x00000001072f642f libsystem_pthread.dylib`pthread_kill + 90 
    frame #2: 0x000000010705319a libsystem_sim_c.dylib`abort + 129 
    frame #3: 0x0000000106e14481 libc++abi.dylib`abort_message + 257 
    frame #4: 0x0000000106e3c3d5 libc++abi.dylib`default_terminate_handler() + 267 
    frame #5: 0x0000000104ce1e19 libobjc.A.dylib`_objc_terminate() + 103 
    frame #6: 0x0000000106e39b01 libc++abi.dylib`std::__terminate(void (*)()) + 8 
    frame #7: 0x0000000106e397aa libc++abi.dylib`__cxa_rethrow + 99 
    frame #8: 0x0000000104ce1d2c libobjc.A.dylib`objc_exception_rethrow + 40 
    frame #9: 0x0000000105dfc53e CoreFoundation`CFRunLoopRunSpecific + 654 
    frame #10: 0x0000000107a659f0 GraphicsServices`GSEventRunModal + 161 
    frame #11: 0x000000010358a420 UIKit`UIApplicationMain + 1282 
    * frame #12: 0x0000000102c861c3 HomeDiary`main(argc=1, argv=0x00007fff5cf8e348) + 115 at main.m:16 
    frame #13: 0x0000000106fa5145 libdyld.dylib`start + 1 

回答

2

導致崩潰的原因是在第一線... Collection <__NSSetM: 0x7fda3c871090> was mutated while being enumerated.

這意味着你有一個NSMutableSet,並且您枚舉它for (id someObject in mySet) {}[mySet enumerateObjects...和枚舉裏面你是變異的集合。

事情是這樣的......

for (id someObject in mySet) { 
    [mySet removeObject:someObject]; 
} 

或類似的東西。你不能這樣做,它會崩潰......因此你的崩潰。

要找到發生這種情況的位置,您需要爲項目添加一個異常斷點。然後這將停止導致崩潰的代碼行上的執行。

+0

謝謝..你的回答有點幫助。 – 2015-02-25 05:37:22

+0

在這種情況下,「你」是Apple。 NSISEngine是iOS的Auto Layout支持的一部分。設置斷點將無濟於事,因爲回溯中的符號都不適用於應用程序本身的代碼。因此,無論您的應用程序是否導致Apple代碼稍後失敗,您在崩潰發生之前就已經完成了它,並且這可能與Auto Layout約束有關。這就是我所能說的。 – dgatwood 2015-04-23 23:31:51

相關問題