我正在寻找几个小时来找到这个零星异常的根本原因。当我以模态方式呈现视图控制器时,我发生在模拟器中。它发生在5-15th segue之间我做...我可以通过在我的segues之间前后移动来重现它...没有泄漏(用仪器检查)任何想法我怎么能找到loc所在的位置可能会出现错误......堆栈跟踪没有给我任何线索!
2014-05-05 18:08:07.095 [9882:60b]准备segue查看 controller:BCPhotoBrowserViewController 2014-05-05 18:08:19.541 [9882:60b] *因未捕获的异常而终止应用 'NSGenericException',原因:'* 收集在枚举时发生了变异。 * 第一次抛出调用堆栈:(0 CoreFoundation 0x00000001033ad495 exceptionPreprocess + 165 1 libobjc.A.dylib
类型的未捕获异常
0x000000010259399e objc_exception_throw + 43 2 CoreFoundation
0x000000010343168e __NSFastEnumerationMutationHandler + 126 3 UIKit 0x000000010119438c - [UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 321 4 UIKit 0x00000001011944ef __85- [UIView(Hierarchy)_makeSubtreePerformSelector:withObject:withObject:copySublayers:] _ block_invoke + 116 5 UIKit 0x00000001011943fe - [UIView(Hierarchy)_makeSubtreePerformSelector:withObject:withObject:copySublayers:] + 435 6 UIKit 0x000000010119e031 - [UIView(内部)_addSubview:定位:relativeTo:] + 873 7 UIKit 0x000000010141b778 - [UINavigationTransitionView转换:fromView:toView:] + 454 8 UIKit 0x000000010141b5b0 - [UINavigationTransitionView转换:toView:] + 25 9 UIKit 0x00000001012584d7 - [UINavigationController _startTransition:fromViewController:toViewController:] + 2893 10 UIKit 0x0000000101258787 - [UINavigationController _startDeferredTransitionIfNeeded:] + 547 11 UIKit 0x0000000101259238 - [UINavigationController __viewWillLayoutSubviews] + 43 12 UIKit 0x0000000101373895 - [UILayoutContainerView layoutSubviews] + 202 13 UIKit 0x0000000114a24040 - [UILayoutContainerViewAccessibility(SafeCategory)layoutSubviews] + 43 14 UIKit 0x00000001011a0993 - [UIView(CALayerDelegate)layoutSublayersOfLayer:] + 354 15 QuartzCore 0x00000001031d6802 - [CALayer layoutSublayers] + 151 16 QuartzCore
0x00000001031cb369 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 363 17 QuartzCore 0x00000001031cb1ea _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24 18 QuartzCore 0x000000010313efb8 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 252 19 QuartzCore 0x0000000103140030 _ZN2CA11Transaction6commitEv + 394 20 QuartzCore 0x000000010314069d _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 89 21 CoreFoundation 0x0000000103378dc7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION + 23 22 CoreFoundation 0x0000000103378d37 __CFRunLoopDoObservers + 391 23 CoreFoundation 0x0000000103358522 __CFRunLoopRun + 946 24 CoreFoundation
0x0000000103357d83 CFRunLoopRunSpecific + 467 25图形服务
0x0000000104504f04 GSEventRunModal + 161 26 UIKit
0x0000000101140e33 UIApplicationMain + 1010 27
0x00000001000e41b5 main + 245 28 libdyld.dylib
0x0000000103d355fd start + 1)libc ++ abi.dylib:终止于 NSException(lldb)
答案 0 :(得分:2)
@Larme在评论中是正确的,在您的代码中的某个位置,您在枚举时正在对您的集合执行某些操作。它不会出现在仪器中,因为它不是泄漏,而是使用集合时的编程错误。
在枚举该集合时,查找添加,删除对象的任何内容。