执行Segue时无法识别的选择器实例

时间:2017-05-02 00:33:09

标签: ios swift

当以编程方式执行segue时,segue会起作用并打开预期的故事板,但会在之后立即终止。视图控制器/故事板确实有效,并且代码中没有任何错误,因为我已经单独测试过,因此我不能完全确定它为什么会终止。任何帮助将不胜感激。

    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) 

2 个答案:

答案 0 :(得分:1)

问题(在上面的评论中发现)是故事板中有一个动作,不再与代码中的动作挂钩。

如果将来有其他人遇到类似问题,请查看出口菜单中的插座或操作,并在控制台输出中提供该名称。在这种情况下,操作名为NameInputEditingDidEnd

答案 1 :(得分:0)

要扩展Nathan的答案,而不是随机环顾四周,只需cmd + shift + f插座的名称,在这种情况下为NameInputEditingDidEnd,xcode将为您和中心输出带有悬空插座的故事板你呢。

Like so