Swift:使用NSException类型的未捕获异常终止 [英] Swift: Terminating with uncaught exception of type NSException

查看:1113
本文介绍了Swift:使用NSException类型的未捕获异常终止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个简单的应用程序,当我点击注册用户时,应用程序将被终止。请帮我搞清楚。

I'm developing a simple app and when I click to sign up the user, the app gets terminated. Please help me figure this out.

它说:


终止app由于未捕获的异常'NSUnknownKeyException',
原因:'[
setValue:forUndefinedKey:]:此类不是键值
编码兼容的关键CreditCardTextField。'

Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key CreditCardTextField.'

这是错误更详细:


015-06 -04 22:42:57.661 ParseStarterProject [43853:4461316]未知
类Interface Builder文件中的RegisterPageViewController。 2015-06-04
22:42:57.712 ParseStarterProject [43853:4461316] *由于未捕获的异常'NSUnknownKeyException'而终止app
,原因:
'[setValue:forUndefinedKey: ]:这个
类不是键值
CreditCardTextField的键值编码。'
*
第一个抛出调用堆栈:(0 CoreFoundation 0x00000001106ccf35 exceptionPreprocess + 165 1 libobjc.A.dylib

0x000000011233ebb7 objc_exception_throw + 45 2 CoreFoundation

0x00000001106ccb79 - [NSException raise] + 9 3 Foundation

0x0000000110b6b7b3 - [NSObject(NSKeyValueCoding)setValue :forKey:] +
259 4 CoreFoundation 0x0000000110616e80
- [NSArray makeObjectsPerformSelector:] + 224 5 UIKit 0x000000011134bc7d - [UINib instantiateWithOwner:options:] + 1506 6

UIKit 0x00000001111aaf98
- [UIVi ewController _loadViewFromNibNamed:bundle:] + 242 7 UIKit 0x00000001111ab588 - [UIViewController loadView] + 109 8 UIKit

0x00000001111ab7f9 - [UIViewController loadViewIfRequired] + 75 9

UIKit 0x00000001111abc8e
- [UIViewController视图] + 27 10 UIKit 0x000000011174d41e - [_ UIFullscreenPresentationController
_setPresentedViewController:] + 65 11 UIKit 0x0000000111187429 - [UIPresentationController
initWithPresentedViewController:presentsViewController:] + 105 12
UIKit 0x00000001111b7a41
- [UIViewController _presentViewController:withAnimationController:completion:] + 1746 13 UIKit 0x00000001111b9d81
__62- [UIViewController presentViewController:animated:completion:] _ block_invoke + 132 14
UIKit 0x00000001111b9ca5
- [UIViewController presentViewController:animated:completion:] + 229 15 UIKit 0x00000001110878be
- [UIApplication sendAction:to:from:forEvent:] + 75 16 UIKit 0x000000011118e410 - [UIControl _sendActionsForEvents:withEvent:] + 467
17 UIKit 0x000000011118d7df
- [UIControl touchesEnded:withEvent:] + 522 18 UIKit 0x00000001110cd308 - [UIWindow _sendTouchesForEvent:] + 735 19 UIKit
0x00000001110cdc33 - [UIWindow sendEvent:] + 683 20 UIKit

0x000000011109a9b1 - [UIApplication sendEvent:] + 246 21 UIKit

0x00000001110a7a7d _UIApplicationHandleEventFromQueueEvent + 17370 22
UIKit 0x0000000111083103
_UIApplicationHandleEventQueue + 1961 23 CoreFoundation 0x0000000110602551
__CFRUNLOOP_IS_CALLING_OUT_ TO_A_SOURCE0_PERFORM_FUNCTION + 17 24的CoreFoundation 0x00000001105f841d
__CFRunLoopDoSources0 + 269 25的CoreFoundation 0x00000001105f7a54 __CFRunLoopRun + 868 26的CoreFoundation点击
0x00000001105f7486 CFRunLoopRunSpecific + 470个27 GraphicsServices结果,
0x0000000113de79f0 GSEventRunModal + 161 28 UIKit

0x0000000111086420 UIApplicationMain + 1282 29 ParseStarterProject

0x000000010fbbe9de top_level_code + 78 30 ParseStarterProject

0x000000010fbbeaba main + 42 31 libdyld.dylib

0x0000000112b54145 start + 1 32 ????
0x0000000000000001 0x0 + 1)libc ++ abi.dylib:以
终止$ NSException类型的未捕获异常(lldb)

015-06-04 22:42:57.661 ParseStarterProject[43853:4461316] Unknown class RegisterPageViewController in Interface Builder file. 2015-06-04 22:42:57.712 ParseStarterProject[43853:4461316] * Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key CreditCardTextField.' * First throw call stack: ( 0 CoreFoundation 0x00000001106ccf35 exceptionPreprocess + 165 1 libobjc.A.dylib
0x000000011233ebb7 objc_exception_throw + 45 2 CoreFoundation
0x00000001106ccb79 -[NSException raise] + 9 3 Foundation
0x0000000110b6b7b3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259 4 CoreFoundation 0x0000000110616e80 -[NSArray makeObjectsPerformSelector:] + 224 5 UIKit 0x000000011134bc7d -[UINib instantiateWithOwner:options:] + 1506 6
UIKit 0x00000001111aaf98 -[UIViewController _loadViewFromNibNamed:bundle:] + 242 7 UIKit 0x00000001111ab588 -[UIViewController loadView] + 109 8 UIKit
0x00000001111ab7f9 -[UIViewController loadViewIfRequired] + 75 9
UIKit 0x00000001111abc8e -[UIViewController view] + 27 10 UIKit 0x000000011174d41e -[_UIFullscreenPresentationController _setPresentedViewController:] + 65 11 UIKit 0x0000000111187429 -[UIPresentationController initWithPresentedViewController:presentingViewController:] + 105 12 UIKit 0x00000001111b7a41 -[UIViewController _presentViewController:withAnimationController:completion:] + 1746 13 UIKit 0x00000001111b9d81 __62-[UIViewController presentViewController:animated:completion:]_block_invoke + 132 14 UIKit 0x00000001111b9ca5 -[UIViewController presentViewController:animated:completion:] + 229 15 UIKit 0x00000001110878be -[UIApplication sendAction:to:from:forEvent:] + 75 16 UIKit 0x000000011118e410 -[UIControl _sendActionsForEvents:withEvent:] + 467 17 UIKit 0x000000011118d7df -[UIControl touchesEnded:withEvent:] + 522 18 UIKit 0x00000001110cd308 -[UIWindow _sendTouchesForEvent:] + 735 19 UIKit 0x00000001110cdc33 -[UIWindow sendEvent:] + 683 20 UIKit
0x000000011109a9b1 -[UIApplication sendEvent:] + 246 21 UIKit
0x00000001110a7a7d _UIApplicationHandleEventFromQueueEvent + 17370 22 UIKit 0x0000000111083103 _UIApplicationHandleEventQueue + 1961 23 CoreFoundation 0x0000000110602551 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION
+ 17 24 CoreFoundation 0x00000001105f841d __CFRunLoopDoSources0 + 269 25 CoreFoundation 0x00000001105f7a54 __CFRunLoopRun + 868 26 CoreFoundation
0x00000001105f7486 CFRunLoopRunSpecific + 470 27 GraphicsServices
0x0000000113de79f0 GSEventRunModal + 161 28 UIKit
0x0000000111086420 UIApplicationMain + 1282 29 ParseStarterProject
0x000000010fbbe9de top_level_code + 78 30 ParseStarterProject
0x000000010fbbeaba main + 42 31 libdyld.dylib
0x0000000112b54145 start + 1 32 ???
0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)


推荐答案

你似乎有 CreditCardT的铜棒@IBOutlet extField ,检查你的故事板,一旦重新连接插座,它就可以再次工作

It seems that you have a bronken @IBOutlet for CreditCardTextField, check in your storyboard, as soon as you reconnect the outlet it all should work again

setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key CreditCardTextField.'

这是你检查你的网点的方式:

This is how you check your outlets:

选择字段,右边的插座应正确连接,代码中的圆圈内部应有一个圆点,如果没有连接断开,控制拖动以修复它。

Select the field, the outlets in the right should be connect correctly and the circles in the code should have a dot inside, if not the connection is broken, control drag to fix it.

这篇关于Swift:使用NSException类型的未捕获异常终止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆