Push Segue Error even when “Push Segue” is not used (I used modal segue)

北城余情 提交于 2019-12-25 04:27:07

问题


I got this error: 'Push segues can only be used when the source controller is managed by an instance of UINavigationController.'

I've encountered this error before and I am very familiar with it. It's usually associated with the use of a navigation controller. However, in my storyboard, I used a modal segue and I did not use a navigation controller. I have no clue why this error is there...

I also updated the class ViewController to MasterViewController as the Initial View Controller but Xcode never updated this information...I'm wondering how I can get it to update. I already did a "Clean Build" before compiling.

2014-02-21 20:18:27.039 GeoLocations[9599:70b] Unknown class ViewController in Interface Builder file.
2014-02-21 20:18:29.225 GeoLocations[9599:70b] *** Terminating app due to uncaught exception 'NSGenericException', reason: 
'Push segues can only be used when the source controller is managed by an instance of UINavigationController.'
    *** First throw call stack:
    (
        0   CoreFoundation                      0x030035e4 __exceptionPreprocess + 180
        1   libobjc.A.dylib                     0x0247d8b6 objc_exception_throw + 44
        2   UIKit                               0x0172fca5 -[UIStoryboardPushSegue destinationContainmentContext] + 0
        3   UIKit                               0x0172007e -[UIStoryboardSegueTemplate _perform:] + 174
        4   UIKit                               0x017200f9 -[UIStoryboardSegueTemplate perform:] + 115
        5   libobjc.A.dylib                     0x0248f874 -[NSObject performSelector:withObject:withObject:] + 77
        6   UIKit                               0x011ed0c2 -[UIApplication sendAction:to:from:forEvent:] + 108
        7   UIKit                               0x011ed04e -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 61
        8   UIKit                               0x012e50c1 -[UIControl sendAction:to:forEvent:] + 66
        9   UIKit                               0x012e5484 -[UIControl _sendActionsForEvents:withEvent:] + 577
        10  UIKit                               0x012e4733 -[UIControl touchesEnded:withEvent:] + 641
        11  UIKit                               0x0122a51d -[UIWindow _sendTouchesForEvent:] + 852
        12  UIKit                               0x0122b184 -[UIWindow sendEvent:] + 1232
        13  UIKit                               0x011fee86 -[UIApplication sendEvent:] + 242
        14  UIKit                               0x011e918f _UIApplicationHandleEventQueue + 11421
        15  CoreFoundation                      0x02f8c83f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
        16  CoreFoundation                      0x02f8c1cb __CFRunLoopDoSources0 + 235
        17  CoreFoundation                      0x02fa929e __CFRunLoopRun + 910
        18  CoreFoundation                      0x02fa8ac3 CFRunLoopRunSpecific + 467
        19  CoreFoundation                      0x02fa88db CFRunLoopRunInMode + 123
        20  GraphicsServices                    0x0359e9e2 GSEventRunModal + 192
        21  GraphicsServices                    0x0359e809 GSEventRun + 104
        22  UIKit                               0x011ebd3b UIApplicationMain + 1225
        23  GeoLocations                        0x0000237d main + 141
        24  libdyld.dylib                       0x03f6770d start + 1
    )
    libc++abi.dylib: terminating with uncaught exception of type NSException
    (lldb) 

回答1:


have you attached the Navigation Controller to your first view controller, If not you should have that. As navigation contrller should be embeded, to push another segue.



来源:https://stackoverflow.com/questions/21949638/push-segue-error-even-when-push-segue-is-not-used-i-used-modal-segue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!