Ich entwickle eine einfache App, aber das Problem steckte mir eine lange, lange Zeit!Swift: Beenden App aufgrund der nicht abgefangenen Ausnahme 'NSInvalidArgumentException', Grund: unerkannter Selektor an Instanz 0x7fb179f12260 gesendet '
Ich versuche, ein Modell mit segue zu übertragen!
Die obere Funktion ist eine UITextField
als Aktion, aber wenn ich es zu öffnen. Absturz!
Der andere kann das Modell öffnen. Nicht abstürzen!
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
brauchen wirklich einen Vorschlag!
Danke für Ihre Empfehlung! – HungCLo
Es gibt keine Funktion namens "setNewPintext" in showVerifyViewController. –
@Eiko unabhängig davon, was das richtige Format ist, machte Ihre Bearbeitung der Stacktrace unlesbar –