我正在开发一个简单的应用程序,当我点击为用户注册时,该应用程序被终止。请帮我解决这个问题。
它说:
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] 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)
最佳答案
您似乎有一个用于 CreditCardTextField 的损坏的@IBOutlet,请检查您的 Storyboard,一旦您重新连接 socket ,一切都应该再次工作
setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key CreditCardTextField.'
这是您检查网点的方式:
选择字段,右边的outlets应该连接正确,代码中的圆圈里面应该有一个点,如果没有连接断开,控制拖动修复它。
关于ios - Swift:以 NSException 类型的未捕获异常终止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30657629/
我可以得到Infinity和NaNn=9.0/0#=>Infinityn.class#=>Floatm=0/0.0#=>NaNm.class#=>Float但是当我想直接访问Infinity或NaN时:Infinity#=>uninitializedconstantInfinity(NameError)NaN#=>uninitializedconstantNaN(NameError)什么是Infinity和NaN?它们是对象、关键字还是其他东西? 最佳答案 您看到打印为Infinity和NaN的只是Float类的两个特殊实例的字符串
我不确定传递给方法的对象的类型是否正确。我可能会将一个字符串传递给一个只能处理整数的函数。某种运行时保证怎么样?我看不到比以下更好的选择:defsomeFixNumMangler(input)raise"wrongtype:integerrequired"unlessinput.class==FixNumother_stuffend有更好的选择吗? 最佳答案 使用Kernel#Integer在使用之前转换输入的方法。当无法以任何合理的方式将输入转换为整数时,它将引发ArgumentError。defmy_method(number)
我正在学习Rails,并阅读了关于乐观锁的内容。我已将类型为integer的lock_version列添加到我的articles表中。但现在每当我第一次尝试更新记录时,我都会收到StaleObjectError异常。这是我的迁移:classAddLockVersionToArticle当我尝试通过Rails控制台更新文章时:article=Article.first=>#我这样做:article.title="newtitle"article.save我明白了:(0.3ms)begintransaction(0.3ms)UPDATE"articles"SET"title"='dwdwd
在Cooper的书BeginningRuby中,第166页有一个我无法重现的示例。classSongincludeComparableattr_accessor:lengthdef(other)@lengthother.lengthenddefinitialize(song_name,length)@song_name=song_name@length=lengthendenda=Song.new('Rockaroundtheclock',143)b=Song.new('BohemianRhapsody',544)c=Song.new('MinuteWaltz',60)a.betwee
这里有一个很好的答案解释了如何在Ruby中下载文件而不将其加载到内存中:https://stackoverflow.com/a/29743394/4852737require'open-uri'download=open('http://example.com/image.png')IO.copy_stream(download,'~/image.png')我如何验证下载文件的IO.copy_stream调用是否真的成功——这意味着下载的文件与我打算下载的文件完全相同,而不是下载一半的损坏文件?documentation说IO.copy_stream返回它复制的字节数,但是当我还没有下
有时我需要处理键/值数据。我不喜欢使用数组,因为它们在大小上没有限制(很容易不小心添加超过2个项目,而且您最终需要稍后验证大小)。此外,0和1的索引变成了魔数(MagicNumber),并且在传达含义方面做得很差(“当我说0时,我的意思是head...”)。散列也不合适,因为可能会不小心添加额外的条目。我写了下面的类来解决这个问题:classPairattr_accessor:head,:taildefinitialize(h,t)@head,@tail=h,tendend它工作得很好并且解决了问题,但我很想知道:Ruby标准库是否已经带有这样一个类? 最佳
我正在尝试解析一个CSV文件并使用SQL命令自动为其创建一个表。CSV中的第一行给出了列标题。但我需要推断每个列的类型。Ruby中是否有任何函数可以找到每个字段中内容的类型。例如,CSV行:"12012","Test","1233.22","12:21:22","10/10/2009"应该产生像这样的类型['integer','string','float','time','date']谢谢! 最佳答案 require'time'defto_something(str)if(num=Integer(str)rescueFloat(s
我正在尝试解析一个文本文件,该文件每行包含可变数量的单词和数字,如下所示:foo4.500bar3.001.33foobar如何读取由空格而不是换行符分隔的文件?有什么方法可以设置File("file.txt").foreach方法以使用空格而不是换行符作为分隔符? 最佳答案 接受的答案将slurp文件,这可能是大文本文件的问题。更好的解决方案是IO.foreach.它是惯用的,将按字符流式传输文件:File.foreach(filename,""){|string|putsstring}包含“thisisanexample”结果的
我正在玩HTML5视频并且在ERB中有以下片段:mp4视频从在我的开发环境中运行的服务器很好地流式传输到chrome。然而firefox显示带有海报图像的视频播放器,但带有一个大X。问题似乎是mongrel不确定ogv扩展的mime类型,并且只返回text/plain,如curl所示:$curl-Ihttp://0.0.0.0:3000/pr6.ogvHTTP/1.1200OKConnection:closeDate:Mon,19Apr201012:33:50GMTLast-Modified:Sun,18Apr201012:46:07GMTContent-Type:text/plain
我早就知道Ruby中的“常量”(即大写的变量名)不是真正常量。与其他编程语言一样,对对象的引用是唯一存储在变量/常量中的东西。(侧边栏:Ruby确实具有“卡住”引用对象不被修改的功能,据我所知,许多其他语言都没有提供这种功能。)所以这是我的问题:当您将一个值重新分配给常量时,您会收到如下警告:>>FOO='bar'=>"bar">>FOO='baz'(irb):2:warning:alreadyinitializedconstantFOO=>"baz"有没有办法强制Ruby抛出异常而不是打印警告?很难弄清楚为什么有时会发生重新分配。 最佳答案