据我所知,变量在GameScene中被识别,但是当我在模拟器中打开SPSwipes视图时,会出现’NSUnkNownKeyException’错误.这是通过一个段落完成的.以下是错误更详细的信息:
2014-11-09 15:32:43.718 Swipe Racer[2644:1620056] *** Terminating app due to uncaught exception 'NSUnkNownKeyException',reason: '[<Swipe_Racer.SPSwipes 0x7fbf52d461b0> setValue:forUndefinedKey:]: this class is not key value Coding-compliant for the key fiveSwipes.'*** First throw call stack:(0 CoreFoundation 0x000000010c021f35 __exceptionPreprocess + 1651 libobjc.A.dylib 0x000000010dd1bbb7 objc_exception_throw + 452 CoreFoundation 0x000000010c021b79 -[NSException raise] + 93 Foundation 0x000000010c4397b3 -[NSObject(NSkeyvalueCoding) setValue:forKey:] + 2594 CoreFoundation 0x000000010bf6be80 -[NSArray makeObjectsPerformSelector:] + 2245 UIKit 0x000000010cd28c7d -[UINib instantiateWithOwner:options:] + 15066 UIKit 0x000000010cb87f98 -[UIVIEwController _loadVIEwFromNibnamed:bundle:] + 2427 UIKit 0x000000010cb88588 -[UIVIEwController loadVIEw] + 1098 UIKit 0x000000010cb887f9 -[UIVIEwController loadVIEwIfrequired] + 759 UIKit 0x000000010cb88c8e -[UIVIEwController vIEw] + 2710 UIKit 0x000000010caa7ca9 -[UIWindow addRootVIEwControllerVIEwIfPossible] + 5811 UIKit 0x000000010caa8041 -[UIWindow _setHIDden:forced:] + 24712 UIKit 0x000000010cab472c -[UIWindow makeKeyAndVisible] + 4213 UIKit 0x000000010ca5f061 -[UIApplication _callinitializationDelegatesForMainScene:TransitionContext:] + 262814 UIKit 0x000000010ca61d2c -[UIApplication _runWithMainScene:TransitionContext:completion:] + 135015 UIKit 0x000000010ca60bf2 -[UIApplication workspaceDIDEndTransaction:] + 17916 FrontBoardServices 0x000000011383b2a3 __31-[FBSSerialQueue performAsync:]_block_invoke + 1617 CoreFoundation 0x000000010bf5753c __CFRUNLOOP_IS_CALliNG_OUT_TO_A_BLOCK__ + 1218 CoreFoundation 0x000000010bf4d285 __CFRunLoopdoblocks + 34119 CoreFoundation 0x000000010bf4d045 __CFRunLoopRun + 238920 CoreFoundation 0x000000010bf4c486 CFRunLoopRunspecific + 47021 UIKit 0x000000010ca60669 -[UIApplication _run] + 41322 UIKit 0x000000010ca63420 UIApplicationMain + 128223 Swipe Racer 0x000000010be380de top_level_code + 7824 Swipe Racer 0x000000010be3811a main + 4225 libdyld.dylib 0x000000010e507145 start + 126 ??? 0x0000000000000001 0x0 + 1)libc++abi.dylib: terminating with uncaught exception of type NSException(lldb)
正如你所看到的,我的第一个变量有五个问题(我会想像两个人之间会有错误).什么是’这个类不是关键的五重要的编码符合五重要的意义?我该如何解决?
我的SPSwipes.swift文件:
class SPSwipes: UIVIEwController {var no_of_swipes = 0@IBAction func fiveSwipes(sender: AnyObject) { no_of_swipes = 5//and so on}
先谢谢你,
将
解决方法 问题是该按钮与许多IBActions相关联 – 其中三个不存在.我右键单击界面生成器中的按钮,并删除旧的和不相关的链接,解决问题. 总结以上是内存溢出为你收集整理的ios – Swift:由于未捕获的异常引起的应用程序终止’NSUnknownKeyException’全部内容,希望文章能够帮你解决ios – Swift:由于未捕获的异常引起的应用程序终止’NSUnknownKeyException’所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)