سؤال

I am looking already for hours to find the root cause of this sporadic exception I am getting. I happens in the simulator when I present a view controller modally. It happens between the 5-15th segue I do... I can sort of reproduce it, by going back and forward between my segues... There are no leaks (checked with instruments) Any ideas how I can find the loc where the error could appear... the stack trace does not give me any clue!

2014-05-05 18:08:07.095 [9882:60b] Preparing for segue to view controller: BCPhotoBrowserViewController 2014-05-05 18:08:19.541 [9882:60b] * Terminating app due to uncaught exception 'NSGenericException', reason: '* Collection was mutated while being enumerated.' * First throw call stack: ( 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(Internal) _addSubview:positioned:relativeTo:] + 873 7 UIKit 0x000000010141b778 -[UINavigationTransitionView transition:fromView:toView:] + 454 8 UIKit 0x000000010141b5b0 -[UINavigationTransitionView transition: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 GraphicsServices
0x0000000104504f04 GSEventRunModal + 161 26 UIKit
0x0000000101140e33 UIApplicationMain + 1010 27
0x00000001000e41b5 main + 245 28 libdyld.dylib
0x0000000103d355fd start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

هل كانت مفيدة؟

المحلول

@Larme is right in the comments, somewhere in your code you are doing something to your collection while you are enumerating. It would not come up in instruments, because it is not a leak, but a programming error while using collections.

Look for any adding, removing of objects to a collection while enumerating on that collection.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top