2016-05-23 9 views
-2

私は簡単なアプリケーションを開発していますが、Swift:キャッチされていない例外 'NSInvalidArgumentException'のためアプリケーションを終了します。理由:インスタンスに送信された認識できないセレクタ0x7fb179f12260 '

私はsegueでモデルをトランジットしようとしています!

アクションの上位1つの機能はUITextFieldですが、開くときに使用します。クラッシュ!

もう1つはモデルを開くことができます。クラッシュではありません!

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

@エイコ正しい形式が何であるかに関係なく、あなたの編集によってスタックトレースが読めなくなりました –

答えて

1

SoftPin.showVerifyViewControllersetNewPintext:を呼び出していますが、このメソッドは存在しません。たぶんタイプミス?おそらくsetNewPinText(大文字の場合はT):

+0

答えが分かりません。私は、verifyTextという名前のアウトレットとsetNewPinTextという関数を設定しました。なぜ方法は存在しないのですか? – HungCLo

+0

メソッドの定義方法とは異なる名前でメソッドを呼び出します。これは 'setNewPintext'(' SoftPin.showVerifyViewController.setNewPintext( "something") 'のように、小文字の' t')として呼び出されるようです。しかし、あなたのアップデートで見られるように、 'setNewPinText'(大文字の' T')で定義されています。 – Daniel

関連する問題