Swift ViewController textFieldCancel:]:在segue期间发送到实例的无法识别的选择器

时间:2015-05-23 01:26:32

标签: swift cocoa-touch ios8 segue

当我尝试从我的初始UIViewController转到页面视图控制器时,我遇到了一个恼人的问题。我的初始UIViewController除其他外包括UITextField。在我完全使用UIViewController之后,每次尝试从我的初始版UITextField中删除时,应用程序都会崩溃并显示以下错误。如果我不与UITextField进行互动,我似乎可以随意使用segues。通过阅读其他帖子,我可以相信UITextField使用了一些我没有正确发布的资源,但是在尝试了多次远程尝试修复它之后,我就会这样做。遗漏了想法/知识。

错误讯息:

2015-05-22 20:10:13.961 checkdgt[7503:506991] -[checkdgt.ViewController textFieldCancel:]: unrecognized selector sent to instance 0x7f8750826e00
2015-05-22 20:10:14.033 checkdgt[7503:506991] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[checkdgt.ViewController textFieldCancel:]: unrecognized selector sent to instance 0x7f8750826e00'
*** First throw call stack:
(
    0   CoreFoundation                      0x000000010bd00c65 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010df63bb7 objc_exception_throw + 45
    2   CoreFoundation                      0x000000010bd080ad -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x000000010bc5e13c ___forwarding___ + 988
    4   CoreFoundation                      0x000000010bc5dcd8 _CF_forwarding_prep_0 + 120
    5   UIKit                               0x000000010cc5dda2 -[UIApplication sendAction:to:from:forEvent:] + 75
    6   UIKit                               0x000000010cd6f54a -[UIControl _sendActionsForEvents:withEvent:] + 467
    7   UIKit                               0x000000010cd6e09a -[UIControl cancelTouchTracking] + 44
    8   UIKit                               0x000000010cd6eadd -[UIControl _didMoveFromWindow:toWindow:] + 89
    9   UIKit                               0x000000010ccd774a -[UIView(Internal) _didMoveFromWindow:toWindow:] + 698
    10  UIKit                               0x000000010ccd774a -[UIView(Internal) _didMoveFromWindow:toWindow:] + 698
    11  UIKit                               0x000000010cccfecf __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke + 125
    12  UIKit                               0x000000010cccfe43 -[UIView(Hierarchy) _postMovedFromSuperview:] + 437
    13  UIKit                               0x000000010cccdfa3 -[UIView(Hierarchy) removeFromSuperview] + 479
    14  UIKit                               0x000000010cd6c4dc __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke504 + 657
    15  UIKit                               0x000000010cd684f2 -[UIPresentationController transitionDidFinish:] + 87
    16  UIKit                               0x000000010d31a2ed -[_UIFullscreenPresentationController transitionDidFinish:] + 70
    17  UIKit                               0x000000010cd6ab7c __56-[UIPresentationController runTransitionForCurrentState]_block_invoke_2 + 133
    18  UIKit                               0x000000010d3a97c0 -[_UIViewControllerTransitionContext completeTransition:] + 110
    19  UIKit                               0x000000010cd65be3 -[UITransitionView _didCompleteTransition:] + 1120
    20  UIKit                               0x000000010ccbc136 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 209
    21  UIKit                               0x000000010ccbc46c -[UIViewAnimationState animationDidStop:finished:] + 76
    22  QuartzCore                          0x000000010ca43882 _ZN2CA5Layer23run_animation_callbacksEPv + 308
    23  libdispatch.dylib                   0x000000010e693614 _dispatch_client_callout + 8
    24  libdispatch.dylib                   0x000000010e67ba1c _dispatch_main_queue_callback_4CF + 1664
    25  CoreFoundation                      0x000000010bc681f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    26  CoreFoundation                      0x000000010bc29dcb __CFRunLoopRun + 2043
    27  CoreFoundation                      0x000000010bc29366 CFRunLoopRunSpecific + 470
    28  GraphicsServices                    0x000000010f88ba3e GSEventRunModal + 161
    29  UIKit                               0x000000010cc5c900 UIApplicationMain + 1282
    30  checkdgt                            0x000000010b1f3f87 main + 135
    31  libdyld.dylib                       0x000000010e6c7145 start + 1
    32  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

调用segue之前的最后一段代码:

@IBAction func learnButtonPressed(sender: UIButton) {

    view.endEditing(true)
    textInputFieldOutlet.resignFirstResponder()
    textFieldShouldEndEditing(textInputFieldOutlet)
    performSegueWithIdentifier("LearnPagesSegue", sender: nil)
}

我无法在名为-textFieldCancel的代码中找到任何方法或对象,我能想到的唯一其他UITextField将位于包含的CardIO库中,似乎不是嫌疑人。

我正在使用Xcode 6.3.2和最新版本的Swift。

感谢任何帮助或温柔的推动。

谢谢!

1 个答案:

答案 0 :(得分:1)

通过在故事板中右键单击并检查列表中的插座,检查按钮中是否存在旧连接。您可能有一个忘记消除的旧连接。