I a rookie in OBjective C. I am writing a login feature in Xcode. But it crashes. Seeking for help!
2016-02-06 03:14:09.331 Login[3466:392205] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle (loaded)' with name 'ViewController''
* First throw call stack:
(
0 CoreFoundation 0x0000000101b81f45 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001015fbdeb objc_exception_throw + 48
2 CoreFoundation 0x0000000101b81e7d +[NSException raise:format:] + 205
3 UIKit 0x00000001022e4eff -[UINib instantiateWithOwner:options:] + 499
4 UIKit 0x00000001020bfc16 -[UIViewController _loadViewFromNibNamed:bundle:] + 381
5 UIKit 0x00000001020c0542 -[UIViewController loadView] + 178
6 UIKit 0x00000001020c08a0 -[UIViewController loadViewIfRequired] + 138
7 UIKit 0x00000001020c1013 -[UIViewController view] + 27
8 UIKit 0x0000000101f9a51c -[UIWindow addRootViewControllerViewIfPossible] + 61
9 UIKit 0x0000000101f9ac05 -[UIWindow _setHidden:forced:] + 282
10 UIKit 0x0000000101fac4a5 -[UIWindow makeKeyAndVisible] + 42
11 UIKit 0x0000000101f26396 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4131
12 UIKit 0x0000000101f2c9c3 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1750
13 UIKit 0x0000000101f29ba3 -[UIApplication workspaceDidEndTransaction:] + 188
14 FrontBoardServices 0x00000001048d9784 -[FBSSerialQueue _performNext] + 192
15 FrontBoardServices 0x00000001048d9af2 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
16 CoreFoundation 0x0000000101aae011 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
17 CoreFoundation 0x0000000101aa3f3c __CFRunLoopDoSources0 + 556
18 CoreFoundation 0x0000000101aa33f3 __CFRunLoopRun + 867
19 CoreFoundation 0x0000000101aa2e08 CFRunLoopRunSpecific + 488
20 UIKit 0x0000000101f294f5 -[UIApplication _run] + 402
21 UIKit 0x0000000101f2e30d UIApplicationMain + 171
22 Login 0x00000001010fd33f main + 111
23 libdyld.dylib 0x00000001042a592d start + 1
24 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) bt
* thread #1: tid = 0x5fc0d, 0x00000001045db286 libsystem_kernel.dylib__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x00000001045db286 libsystem_kernel.dylib__pthread_kill + 10
frame #1: 0x00000001045a49f9 libsystem_pthread.dylibpthread_kill + 90
frame #2: 0x000000010434ca44 libsystem_c.dylibabort + 129
frame #3: 0x000000010414a051 libc++abi.dylibabort_message + 257
frame #4: 0x000000010416fac9 libc++abi.dylibdefault_terminate_handler() + 267
frame #5: 0x00000001015fc046 libobjc.A.dylib_objc_terminate() + 103
frame #6: 0x000000010416d26e libc++abi.dylibstd::__terminate(void (*)()) + 8
frame #7: 0x000000010416cef9 libc++abi.dylib__cxa_rethrow + 99
frame #8: 0x00000001015fbf5e libobjc.A.dylibobjc_exception_rethrow + 40
frame #9: 0x0000000101aa2ec4 CoreFoundationCFRunLoopRunSpecific + 676
frame #10: 0x0000000101f294f5 UIKit-[UIApplication _run] + 402
frame #11: 0x0000000101f2e30d UIKitUIApplicationMain + 171
* frame #12: 0x00000001010fd33f Loginmain(argc=1, argv=0x00007fff5eb02650) + 111 at main.m:14
frame #13: 0x00000001042a592d libdyld.dylib`start + 1
(lldb)
To fix the problem,in Two ways:
Option-1
regarding the nib name. Check the nib name spelling, it's correct, case sensitive.
Option-2
if option -1 does not work try this
Open XCode Target
Go to the "Build phases" tab
Click the "Copy bundle resources" section
Click the add button
Add the missing Nib file
then works fine
Related
When performing programatically performing a segue, the segue does work and the intended storyboard opens, but terminates immediately afterwards. The view controller/storyboard does work and shouldn't have any errors in the code as I've tested it individually, so I'm not entirely sure as to why it terminates. Any help would be appreciated.
2017-05-01 20:22:59.358605 FInal Project[15659:499662] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/student/Library/Developer/CoreSimulator/Devices/265EA47F-07A6-47C7-A6B4-5E62D37E72BA/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2017-05-01 20:22:59.376075 FInal Project[15659:499662] [MC] Reading from private effective user settings.
in
2017-05-01 20:23:48.095 FInal Project[15659:499662] <UILayoutContainerView: 0x7fdae3c082f0; frame = (0 0; 414 736); autoresize = W+H; gestureRecognizers = <NSArray: 0x600000242be0>; layer = <CALayer: 0x60000003ea40>>'s window is not equal to <UINavigationController: 0x7fdae40aee00>'s view's window!
2017-05-01 20:23:48.715 FInal Project[15659:499662] -[FInal_Project.User_Info NameInputEditingDidEnd:]: unrecognized selector sent to instance 0x7fdae3c11d40
2017-05-01 20:23:48.721 FInal Project[15659:499662] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FInal_Project.User_Info NameInputEditingDidEnd:]: unrecognized selector sent to instance 0x7fdae3c11d40'
*** First throw call stack:
(
0 CoreFoundation 0x0000000101fc3d4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x0000000101a2521e objc_exception_throw + 48
2 CoreFoundation 0x0000000102033f04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x0000000101f49005 ___forwarding___ + 1013
4 CoreFoundation 0x0000000101f48b88 _CF_forwarding_prep_0 + 120
5 UIKit 0x00000001030cb8bc -[UIApplication sendAction:to:from:forEvent:] + 83
6 UIKit 0x0000000103251c38 -[UIControl sendAction:to:forEvent:] + 67
7 UIKit 0x0000000103251f51 -[UIControl _sendActionsForEvents:withEvent:] + 444
8 UIKit 0x0000000103bdbc20 -[UITextField _resignFirstResponder] + 313
9 UIKit 0x00000001032e1778 -[UIResponder _finishResignFirstResponder] + 286
10 UIKit 0x0000000103bdba0e -[UITextField _finishResignFirstResponder] + 49
11 UIKit 0x00000001032e1827 -[UIResponder resignFirstResponder] + 140
12 UIKit 0x0000000103bdb8dd -[UITextField resignFirstResponder] + 136
13 UIKit 0x000000010317802f -[UIView(Hierarchy) _removeFirstResponderFromSubtree] + 167
14 UIKit 0x00000001031786b8 __UIViewWillBeRemovedFromSuperview + 76
15 UIKit 0x000000010317846a -[UIView(Hierarchy) removeFromSuperview] + 95
16 UIKit 0x000000010324d451 __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke.629 + 704
17 UIKit 0x0000000103246fba -[UIPresentationController transitionDidFinish:] + 111
18 UIKit 0x000000010345ef83 -[_UICurrentContextPresentationController transitionDidFinish:] + 42
19 UIKit 0x000000010324aef0 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke_2 + 183
20 UIKit 0x0000000103c0c56c -[_UIViewControllerTransitionContext completeTransition:] + 102
21 UIKit 0x0000000103243ddc -[UITransitionView notifyDidCompleteTransition:] + 251
22 UIKit 0x0000000103243aef -[UITransitionView _didCompleteTransition:] + 1539
23 UIKit 0x000000010324651c -[UITransitionView _transitionDidStop:finished:] + 104
24 UIKit 0x0000000103156bd5 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 222
25 UIKit 0x000000010315712a -[UIViewAnimationState animationDidStop:finished:] + 136
26 QuartzCore 0x0000000108526648 _ZN2CA5Layer23run_animation_callbacksEPv + 316
27 libdispatch.dylib 0x0000000105e2e0cd _dispatch_client_callout + 8
28 libdispatch.dylib 0x0000000105e0e8a4 _dispatch_main_queue_callback_4CF + 406
29 CoreFoundation 0x0000000101f87e49 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
30 CoreFoundation 0x0000000101f4d37d __CFRunLoopRun + 2205
31 CoreFoundation 0x0000000101f4c884 CFRunLoopRunSpecific + 420
32 GraphicsServices 0x0000000107d38a6f GSEventRunModal + 161
33 UIKit 0x00000001030c9c68 UIApplicationMain + 159
34 FInal Project 0x00000001013fb65f main + 111
35 libdyld.dylib 0x0000000105e7a68d start + 1
36 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
The issue (discovered in the comments above) was that there was an action in the storyboard that was no longer hooked up to an action in code.
If anyone else in the future has a similar problem, look through the outlets menu for an outlet or action with the name provided in the console output. In this case, the action was named NameInputEditingDidEnd.
To expand on Nathan's answer, instead of randomly looking around, just cmd+shift+f the name of the outlet, in this case NameInputEditingDidEnd, and xcode will output the storyboard with the dangling outlet for you and center you to it.
I am relatively new to Swift and iOS in general. When I create a segue from a button to another view, I get a nasty error message (below). Can someone help me decipher this?
2016-04-17 16:25:49.133 FoodPin[9322:676896] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UITableViewController loadView] instantiated view controller with identifier "UIViewController-u9a-Ka-ctP" from storyboard "Main", but didn't get a UITableView.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000102d58d85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000104afcdeb objc_exception_throw + 48
2 CoreFoundation 0x0000000102d58cbd +[NSException raise:format:] + 205
3 UIKit 0x000000010396e4e2 -[UITableViewController loadView] + 638
4 UIKit 0x000000010371b560 -[UIViewController loadViewIfRequired] + 138
5 UIKit 0x000000010372193b -[UIViewController __viewWillAppear:] + 120
6 UIKit 0x0000000103751750 -[UINavigationController _startCustomTransition:] + 1203
7 UIKit 0x0000000103761b9b -[UINavigationController _startDeferredTransitionIfNeeded:] + 712
8 UIKit 0x0000000103762d0b -[UINavigationController __viewWillLayoutSubviews] + 57
9 UIKit 0x0000000103911503 -[UILayoutContainerView layoutSubviews] + 248
10 UIKit 0x000000010363b980 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 703
11 QuartzCore 0x0000000108006c00 -[CALayer layoutSublayers] + 146
12 QuartzCore 0x0000000107ffb08e _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 366
13 QuartzCore 0x0000000107ffaf0c _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 24
14 QuartzCore 0x0000000107fef3c9 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 277
15 QuartzCore 0x000000010801d086 _ZN2CA11Transaction6commitEv + 486
16 QuartzCore 0x000000010801d7f8 _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 92
17 CoreFoundation 0x0000000102c7dc37 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
18 CoreFoundation 0x0000000102c7dba7 __CFRunLoopDoObservers + 391
19 CoreFoundation 0x0000000102c737fb __CFRunLoopRun + 1147
20 CoreFoundation 0x0000000102c730f8 CFRunLoopRunSpecific + 488
21 GraphicsServices 0x00000001073eead2 GSEventRunModal + 161
22 UIKit 0x0000000103580f09 UIApplicationMain + 171
23 FoodPin 0x0000000102b589f2 main + 114
24 libdyld.dylib 0x00000001055c092d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
My app was working fine prior to the forced upgrade to Swift 2.x. My code below is executed on an IBAction for a button that "collapses" the cell, e.g. it replaces it with another layout and then attempts to reload the cell, which for various reasons I've been forced to include each cell in its own section (so, extensibly I'm reloading the section). I've tried outputting various variables to the terminal; the inputs are sound. I've also tried wrapping this in .beginUpdates() and .endUpdates() and when walking through this in the debugger, it will just throw the below exception on the .endUpdates() call instead of the .reloadSections() call. I have also tried replacing .reloadSections() with a blanket call to .reloadData() and I receive the same stack trace, making me believe it's internal to the TableView object somehow.
// Set Selected Patient Configuration to "Collapsed"
patientList.patients[ sender.tag ].updateConfiguration( collapsedConfiguration )
let animation = UITableViewRowAnimation.Automatic
// Retrieve Current Table View and Animate Changes
let tableView = self.superview!.superview as! UITableView
// Reload Section with Animation
tableView.reloadSections(NSIndexSet( index: sender.tag ), withRowAnimation: animation )
My code will evaluate the backing data's collapsed state and draw it in either the full or collapsed view.
*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM insertObject:atIndex:]: index 2 beyond bounds [0 .. 0]'
*** First throw call stack:
(
0 CoreFoundation 0x00e2fa84 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x03235e02 objc_exception_throw + 50
2 CoreFoundation 0x00cdd211 -[__NSArrayM insertObject:atIndex:] + 881
3 Foundation 0x01510134 -[NSKeyValueSlowMutableArray insertObject:atIndex:] + 115
4 CoreFoundation 0x00d38630 -[NSMutableArray insertObjects:count:atIndex:] + 192
5 CoreFoundation 0x00d38322 -[NSMutableArray insertObjectsFromArray:range:atIndex:] + 322
6 CoreFoundation 0x00d381c2 -[NSMutableArray addObjectsFromArray:] + 834
7 UIKit 0x024f4d4f -[UIRuntimeOutletCollectionConnection performConnect] + 964
8 UIKit 0x024f4daf -[UIRuntimeOutletCollectionConnection connect] + 33
9 libobjc.A.dylib 0x0324a00c -[NSObject performSelector:] + 62
10 CoreFoundation 0x00d60571 -[NSArray makeObjectsPerformSelector:] + 273
11 UIKit 0x021b06f6 -[UINib instantiateWithOwner:options:] + 2102
12 UIKit 0x01eeed6c -[UITableView _dequeueReusableViewOfType:withIdentifier:] + 457
13 UIKit 0x01eef173 -[UITableView dequeueReusableCellWithIdentifier:] + 48
14 Halo 0x001b5174 _TFC4Halo18MainViewController9tableViewfS0_FTCSo11UITableView21cellForRowAtIndexPathCSo11NSIndexPath_CSo15UITableViewCell + 2356
15 Halo 0x001be459 _TToFC4Halo18MainViewController9tableViewfS0_FTCSo11UITableView21cellForRowAtIndexPathCSo11NSIndexPath_CSo15UITableViewCell + 89
16 UIKit 0x01f03a19 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 782
17 UIKit 0x01f03b47 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 90
18 UIKit 0x022568cc -[_UITableViewUpdateSupport(Private) _setupAnimationsForNewlyInsertedCells] + 8353
19 UIKit 0x0226181a -[_UITableViewUpdateSupport _setupAnimations] + 161
20 UIKit 0x01ed7fd3 -[UITableView _updateWithItems:updateSupport:] + 3653
21 UIKit 0x01ecfc91 -[UITableView _endCellAnimationsWithContext:] + 17491
22 UIKit 0x01eea538 -[UITableView _updateSections:updateAction:withRowAnimation:headerFooterOnly:] + 460
23 UIKit 0x01eea625 -[UITableView reloadSections:withRowAnimation:] + 73
24 Halo 0x00105e10 _TFC4Halo28FullPatientViewTableViewCell19collapseButtonPressfS0_FCSo8UIButtonT_ + 6208
25 Halo 0x0010645d _TToFC4Halo28FullPatientViewTableViewCell19collapseButtonPressfS0_FCSo8UIButtonT_ + 61
26 libobjc.A.dylib 0x0324a0b5 -[NSObject performSelector:withObject:withObject:] + 84
27 UIKit 0x01d8016a -[UIApplication sendAction:to:from:forEvent:] + 118
28 UIKit 0x01d800e9 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 64
29 UIKit 0x01f1e19f -[UIControl sendAction:to:forEvent:] + 79
30 UIKit 0x01f1e51f -[UIControl _sendActionsForEvents:withEvent:] + 408
31 UIKit 0x01f1d525 -[UIControl touchesEnded:withEvent:] + 714
32 UIKit 0x022efeaa _UIGestureRecognizerUpdate + 12763
33 UIKit 0x01dfabdf -[UIWindow _sendGesturesForEvent:] + 1559
34 UIKit 0x01dfc298 -[UIWindow sendEvent:] + 1137
35 UIKit 0x01da1efb -[UIApplication sendEvent:] + 266
36 UIKit 0x01d77cb6 _UIApplicationHandleEventQueue + 7802
37 CoreFoundation 0x00d49d1f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
38 CoreFoundation 0x00d3f9ab __CFRunLoopDoSources0 + 523
39 CoreFoundation 0x00d3edc8 __CFRunLoopRun + 1032
40 CoreFoundation 0x00d3e706 CFRunLoopRunSpecific + 470
41 CoreFoundation 0x00d3e51b CFRunLoopRunInMode + 123
42 GraphicsServices 0x058c0664 GSEventRunModal + 192
43 GraphicsServices 0x058c04a1 GSEventRun + 104
44 UIKit 0x01d7e1eb UIApplicationMain + 160
45 Halo 0x0011eb6c main + 140
46 libdyld.dylib 0x03ceca21 start + 1
47 ??? 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
The stack is not very helpful to me and I can't even figure out the opening message: "insertObject:atIndex:]: index 2 beyond bounds [0 .. 0]." No where in this sample and my test with a single table entry should there be an index of '2.' Any help you could provide would be appreciated.
Here's my 'bt' on this exception:
* thread #1: tid = 0xc9ca7, 0x0401969a libsystem_kernel.dylib`__pthread_kill + 10, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x0401969a libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x03fe4634 libsystem_pthread.dylib`pthread_kill + 101
frame #2: 0x03d9339d libsystem_c.dylib`abort + 156
frame #3: 0x04034ae7 libc++abi.dylib`abort_message + 151
frame #4: 0x04055683 libc++abi.dylib`default_terminate_handler() + 300
frame #5: 0x032360b6 libobjc.A.dylib`_objc_terminate() + 108
frame #6: 0x04052d0d libc++abi.dylib`std::__terminate(void (*)()) + 14
frame #7: 0x0405293e libc++abi.dylib`__cxa_rethrow + 103
frame #8: 0x03235fad libobjc.A.dylib`objc_exception_rethrow + 47
frame #9: 0x00d3e7d0 CoreFoundation`CFRunLoopRunSpecific + 672
frame #10: 0x00d3e51b CoreFoundation`CFRunLoopRunInMode + 123
frame #11: 0x058c0664 GraphicsServices`GSEventRunModal + 192
frame #12: 0x058c04a1 GraphicsServices`GSEventRun + 104
frame #13: 0x01d7e1eb UIKit`UIApplicationMain + 160
* frame #14: 0x0011eb6c Halo`main + 140 at AppDelegate.swift:26
frame #15: 0x03ceca21 libdyld.dylib`start + 1
Per request, here's the code followed by the output:
// Retrieve Current Table View and Animate Changes
let tableView = self.superview!.superview as! UITableView
// Test Output
print( "tableView.numberOfSections: \(tableView.numberOfSections)" )
print( "tableView.numberOfRowsInSection( sender.tag ): \(tableView.numberOfRowsInSection( sender.tag ))" )
// Reload Section with Animation
tableView.reloadSections(NSIndexSet( index: sender.tag ), withRowAnimation: animation )
tableView.numberOfSections: 1
tableView.numberOfRowsInSection( sender.tag ): 1
This section of the stack trace (probably) means that you have an IBOutletCollection, and UIKit is now trying to populate it from a storyboard or nib:
7 UIKit 0x024f4d4f -[UIRuntimeOutletCollectionConnection performConnect] + 964
8 UIKit 0x024f4daf -[UIRuntimeOutletCollectionConnection connect] + 33
And this section looks like it’s trying to add bound objects to an existing array:
2 CoreFoundation 0x00cdd211 -[__NSArrayM insertObject:atIndex:] + 881
3 Foundation 0x01510134 -[NSKeyValueSlowMutableArray insertObject:atIndex:] + 115
4 CoreFoundation 0x00d38630 -[NSMutableArray insertObjects:count:atIndex:] + 192
5 CoreFoundation 0x00d38322 -[NSMutableArray insertObjectsFromArray:range:atIndex:] + 322
6 CoreFoundation 0x00d381c2 -[NSMutableArray addObjectsFromArray:] + 834
All of that means that the error may not have anything to do with the code you posted, but rather with your nib and how it interacts with the properties it’s bound to.
Take a look at whether you’re using an IBOutletCollection, and if so, start debugging the things it’s bound to.
Not getting why the app is crashing random time. unable to find any str. Please help.. I am not able to track the issue by this log. please also help me how to deal with such difficult log to track where exactly the issue is.
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
The reason it is crashing is in the first line... Collection <__NSSetM: 0x7fda3c871090> was mutated while being enumerated.
This means you have an NSMutableSet and you are enumerating it for (id someObject in mySet) {} or [mySet enumerateObjects... and inside that enumeration you are mutating the set.
Something like this...
for (id someObject in mySet) {
[mySet removeObject:someObject];
}
Or something like that. You can't do this, it will crash... hence your crash.
To find where this is happening you need to add an Exception Breakpoint to the project. This will then stop the execution on the line of code causing the crash.
I recently upgraded an app I created from iOS 6 to iOS 7 (and Xcode 4 to Xcode 5). I then tried to run the app, and the build said it succeeded, however the app crashed and directed me to this code and the error message:
int retVal = UIApplicationMain(argc, argv, nil, nil);
Thread 1 signal:SIGABRT
The console log is below in case that helps:
2014-01-14 14:30:39.791 Recipes[1808:70b] *** Terminating app due to uncaught exception 'UIViewControllerHierarchyInconsistency', reason: 'A view can only be associated with at most one view controller at a time! View <UIImageView: 0x8ba3e80; frame = (0 0; 320 568); autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x8ba3f10>> is associated with <UIViewController: 0x8b93c60>. Clear this association before associating this view with <UIViewController: 0x8b95690>.'
*** First throw call stack:
(
0 CoreFoundation 0x01ab45e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x018378b6 objc_exception_throw + 44
2 CoreFoundation 0x01ab43bb +[NSException raise:format:] + 139
3 UIKit 0x00a31c99 -[UIView(Internal) _setViewDelegate:] + 242
4 UIKit 0x00ae3ecc +[UIViewController setViewController:forView:] + 40
5 UIKit 0x00ade921 -[UIViewController setView:] + 511
6 Foundation 0x005e6d28 _NSSetUsingKeyValueSetter + 133
7 Foundation 0x005e6253 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 267
8 Foundation 0x0064870a -[NSObject(NSKeyValueCoding) setValue:forKeyPath:] + 412
9 UIKit 0x00c6ca15 -[UIRuntimeOutletConnection connect] + 106
10 libobjc.A.dylib 0x018497d2 -[NSObject performSelector:] + 62
11 CoreFoundation 0x01aafb6a -[NSArray makeObjectsPerformSelector:] + 314
12 UIKit 0x00c6b56e -[UINib instantiateWithOwner:options:] + 1417
13 UIKit 0x00c6d2fb -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 165
14 UIKit 0x009ca3bb -[UIApplication _loadMainNibFileNamed:bundle:] + 58
15 UIKit 0x009ca6e9 -[UIApplication _loadMainInterfaceFile] + 245
16 UIKit 0x009c928f -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 543
17 UIKit 0x009dd87c -[UIApplication handleEvent:withNewEvent:] + 3447
18 UIKit 0x009ddde9 -[UIApplication sendEvent:] + 85
19 UIKit 0x009cb025 _UIApplicationHandleEvent + 736
20 GraphicsServices 0x02ea62f6 _PurpleEventCallback + 776
21 GraphicsServices 0x02ea5e01 PurpleEventCallback + 46
22 CoreFoundation 0x01a2fd65 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
23 CoreFoundation 0x01a2fa9b __CFRunLoopDoSource1 + 523
24 CoreFoundation 0x01a5a77c __CFRunLoopRun + 2156
25 CoreFoundation 0x01a59ac3 CFRunLoopRunSpecific + 467
26 CoreFoundation 0x01a598db CFRunLoopRunInMode + 123
27 UIKit 0x009c8add -[UIApplication _run] + 840
28 UIKit 0x009cad3b UIApplicationMain + 1225
29 Recipes 0x000022cf main + 93
30 libdyld.dylib 0x02b4670d start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Any help is greatly appreciated. Thanks!