2016-05-23 50 views
-2

我正在開發一個簡單的應用程序,但問題卡住了我一個長長久久!斯威夫特:終止應用程序由於未捕獲的異常「NSInvalidArgumentException」,原因是:無法識別的選擇發送到實例0x7fb179f12260'

我嘗試過境模型SEGUE!

上面的一個功能是作爲UITextField行動,但是當我用它打開。崩潰!

另外一個可以打開的模型。沒有崩潰!

class showVerifyViewController: UIViewController { 


    @IBOutlet weak var verifyText: UITextField! 

    @IBAction func setNewPinText(sender: AnyObject) { 
     if verifyText.text == "zzz" { 
      let viewController:UIViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("SetupPinViewController") as UIViewController 
      let navigationView = UINavigationController(rootViewController: viewController) 
      self.presentViewController(navigationView, animated: true, completion: nil) 
     } 
    } 

    @IBAction func showTest(sender: AnyObject) { 
     let viewController:UIViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("SetupPinViewController") as UIViewController 
     let navigationView = UINavigationController(rootViewController: viewController) 
     self.presentViewController(navigationView, animated: true, completion: nil) 
    } 
} 

[SoftPin.showVerifyViewController setNewPintext:]: unrecognized selector sent to instance 0x7fb179f12260 
2016-05-23 18:19:58.372 SoftPin[2805:268743] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SoftPin.showVerifyViewController setNewPintext:]: unrecognized selector sent to instance 0x7fb179f12260' 

0 CoreFoundation      0x00000001051c8d85 __exceptionPreprocess + 165 
1 libobjc.A.dylib      0x0000000106f6cdeb objc_exception_throw + 48 
2 CoreFoundation      0x00000001051d1d3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 
3 CoreFoundation      0x0000000105117cfa ___forwarding___ + 970 
4 CoreFoundation      0x00000001051178a8 _CF_forwarding_prep_0 + 120 
5 UIKit        0x00000001059f2a8d -[UIApplication sendAction:to:from:forEvent:] + 92 
6 UIKit        0x0000000105b65e67 -[UIControl sendAction:to:forEvent:] + 67 
7 UIKit        0x0000000105b66143 -[UIControl _sendActionsForEvents:withEvent:] + 327 
8 UIKit        0x00000001063ef6c5 -[UITextField _resignFirstResponder] + 298 
9 UIKit        0x0000000105c04a1a -[UIResponder _finishResignFirstResponder] + 292 
10 UIKit        0x00000001063ef4ef -[UITextField _finishResignFirstResponder] + 49 
11 UIKit        0x0000000105c04ac9 -[UIResponder resignFirstResponder] + 140 
12 UIKit        0x00000001063ef3bc -[UITextField resignFirstResponder] + 136 
13 UIKit        0x0000000105a97afd -[UIView(Hierarchy) _removeFirstResponderFromSubtree] + 161 
14 UIKit        0x0000000105a9802a __UIViewWillBeRemovedFromSuperview + 71 
15 UIKit        0x0000000105a97e48 -[UIView(Hierarchy) removeFromSuperview] + 99 
16 UIKit        0x0000000105b61afb __71-[UIPresentationController _initViewHierarchyForPresentationSuperview:]_block_invoke596 + 739 
17 UIKit        0x0000000105b5bdbe -[UIPresentationController transitionDidFinish:] + 111 
18 UIKit        0x0000000105d3938f -[_UICurrentContextPresentationController transitionDidFinish:] + 42 
19 UIKit        0x0000000105b5f7c1 __56-[UIPresentationController runTransitionForCurrentState]_block_invoke_2 + 183 
20 UIKit        0x000000010641e4c8 -[_UIViewControllerTransitionContext completeTransition:] + 101 
21 UIKit        0x0000000105b58f77 -[UITransitionView notifyDidCompleteTransition:] + 252 
22 UIKit        0x0000000105b58c88 -[UITransitionView _didCompleteTransition:] + 1344 
23 UIKit        0x0000000105b5b3f4 -[UITransitionView _transitionDidStop:finished:] + 104 
24 UIKit        0x0000000105a7e7ff -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 241 
25 UIKit        0x0000000105a7ebae -[UIViewAnimationState animationDidStop:finished:] + 80 
26 QuartzCore       0x000000010a4723c8 _ZN2CA5Layer23run_animation_callbacksEPv + 308 
27 libdispatch.dylib     0x00000001079fc3eb _dispatch_client_callout + 8 
28 libdispatch.dylib     0x00000001079e41ef _dispatch_main_queue_callback_4CF + 1738 
29 CoreFoundation      0x00000001051220f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9 
30 CoreFoundation      0x00000001050e3b99 __CFRunLoopRun + 2073 
31 CoreFoundation      0x00000001050e30f8 CFRunLoopRunSpecific + 488 
32 GraphicsServices     0x000000010985ead2 GSEventRunModal + 161 
33 UIKit        0x00000001059f0f09 UIApplicationMain + 171 
34 SoftPin        0x0000000104fcacd2 main + 114 
35 libdyld.dylib      0x0000000107a3092d start + 1 
36 ???         0x0000000000000001 0x0 + 1 
) 

    libc++abi.dylib: terminating with uncaught exception of type NSException 

真的需要一些建議!

+0

謝謝您的意見! – HungCLo

+0

showVerifyViewController中沒有名爲「setNewPintext」的函數。 –

+1

@Eiko不管正確的格式是什麼,你的編輯做出的堆棧跟蹤不可讀 –

回答

1

該錯誤告訴您,您在SoftPin.showVerifyViewController上調用setNewPintext:,但該方法不存在。也許是一個錯字?也許這應該是setNewPinText(使用大寫T)?:

+0

你的答案不是很理解。我設置了名爲verifyText的出口和一個名爲setNewPinText的函數。爲什麼該方法不存在? – HungCLo

+0

您可以使用與定義方式不同的名稱調用該方法。它似乎被稱爲'setNewPintext'(如'SoftPin.showVerifyViewController.setNewPintext(「something」)',小寫't')。但是如你所看到的那樣,它被定義爲'setNewPinText'(帶有一個大寫的'T') – Daniel

相關問題