4

My code is crashing with this NSException

2015-12-11 16:43:23.170 twelve[3901:318168] *** Assertion failure in -[UIStoryboardEmbedSegueTemplate newDefaultPerformHandlerForSegue:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.29.5/UIStoryboardEmbedSegueTemplate.m:35

and the red line frozen in the AppDelegate line

class AppDelegate: UIResponder, UIApplicationDelegate {

here is my setup:

enter image description here ViewController.swift

    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    switch (segue.identifier!) {
    case "topSeg":
        segue.destinationViewController as? SafetyVC
    case "mainBtSeg":
        segue.destinationViewController as? MainBtVC
    default:
        break
    }

and the last line in the following block is the line that crashes the app:

extension ViewController: UITableViewDataSource, UITableViewDelegate {
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return rows.count
}


func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
    performSegueWithIdentifier("mainBtSeg", sender: nil)

here is the LogCat:

2015-12-12 03:25:21.387 twelve[4451:372407] *** Assertion failure in -[UIStoryboardEmbedSegueTemplate newDefaultPerformHandlerForSegue:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.29.5/UIStoryboardEmbedSegueTemplate.m:35
2015-12-12 03:25:21.394 twelve[4451:372407] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'There are unexpected subviews in the container view. Perhaps the embed segue has already fired once or a subview was added programmatically?'
*** First throw call stack:
(
 0   CoreFoundation                      0x000000010ded3f45 __exceptionPreprocess + 165
 1   libobjc.A.dylib                     0x000000010fe1fdeb objc_exception_throw + 48
 2   CoreFoundation                      0x000000010ded3daa +[NSException raise:format:arguments:] + 106
 3   Foundation                          0x000000010e5445ee -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
 4   UIKit                               0x000000010f252a60 __67-[UIStoryboardEmbedSegueTemplate newDefaultPerformHandlerForSegue:]_block_invoke + 444
 5   UIKit                               0x000000010f0377c4 -[UIStoryboardSegueTemplate _performWithDestinationViewController:sender:] + 460
 6   UIKit                               0x000000010f0375c7 -[UIStoryboardSegueTemplate _perform:] + 82
 7   UIKit                               0x000000010eaad938 -[UIViewController performSegueWithIdentifier:sender:] + 99
 8   twelve                              0x000000010dce8084 _TFC6twelve14ViewController9tableViewfS0_FTCSo11UITableView23didSelectRowAtIndexPathCSo11NSIndexPath_T_ + 132
 9   twelve                              0x000000010dce831f _TToFC6twelve14ViewController9tableViewfS0_FTCSo11UITableView23didSelectRowAtIndexPathCSo11NSIndexPath_T_ + 79
 10  UIKit                               0x000000010ea58a21 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1968
 11  UIKit                               0x000000010ea58c76 -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 388
 12  UIKit                               0x000000010e9241ba _runAfterCACommitDeferredBlocks + 317
 13  UIKit                               0x000000010e937396 _cleanUpAfterCAFlushAndRunDeferredBlocks + 95
 14  UIKit                               0x000000010e9431c2 _afterCACommitHandler + 90
 15  CoreFoundation                      0x000000010ddff947 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
 16  CoreFoundation                      0x000000010ddff8b7 __CFRunLoopDoObservers + 391
 17  CoreFoundation                      0x000000010ddf550b __CFRunLoopRun + 1147
 18  CoreFoundation                      0x000000010ddf4e08 CFRunLoopRunSpecific + 488
 19  GraphicsServices                    0x0000000113411ad2 GSEventRunModal + 161
 20  UIKit                               0x000000010e91830d UIApplicationMain + 171
 21  twelve                              0x000000010dce992d main + 109
 22  libdyld.dylib                       0x000000011092792d start + 1
 23  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

Thanks

Fred J.
  • 5,759
  • 10
  • 57
  • 106

0 Answers0