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

标签 ios swift

当以编程方式执行 segue 时,segue 会工作并且预期的 Storyboard会打开,但随后会立即终止。 View Controller / Storyboard 确实可以工作,并且代码中应该没有任何错误,因为我已经单独对其进行了测试,因此我不完全确定它终止的原因。任何帮助将不胜感激。

    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) 

最佳答案

问题(在上面的评论中发现)是 Storyboard 中的一个 Action 不再与代码中的 Action Hook 。

如果以后有任何其他人遇到类似问题,请查看 outlets 菜单以查找具有控制台输出中提供的名称的 outlets 或 action。在本例中,该操作被命名为 NameInputEditingDidEnd

关于ios - 执行 Segue 时无法识别的选择器实例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43728375/

相关文章:

ios - 如何在 swift 5 中的每个 Controller 上调用一个函数

ios - 在 iOS 应用程序中使用 GitHub 的 OAuth 身份验证 - 它是如何工作的

ios - 如何仅在 ScrollView 中禁用滚动而不在内容 View 中禁用滚动?

iphone - 自定义本地化解决方案 - 如何提交这样的应用程序?

macos - NSClickGestureRecognizer 不适用于 NSStatusItem

ios - 将字符串转换为带时区的日期

ios - 在函数中调用 Collection View 时返回 nil

ios - 第一次应用程序更新,用户数据丢失(存储在 Documents 目录中)

ios - 表格 View 单元格选择颜色在 0 单元格之后有效但不是第一行?

ios - 删除 coreData ios 中的对象