Xcode“这个类不符合键 pageControl 的键值编码。”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10290224/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 00:04:16  来源:igfitidea点击:

Xcode "this class is not key value coding-compliant for the key pageControl."

iphoneiosxcodepagecontrol

提问by Jordan Clark

Please someone help me! I've been at this all day. I've seen several different stackoverflow questions that got answered with this problem, but I've tried everything, and I just can't figure it out. Here is my whole project so I don't have to paste multiple files worth of code here. The problem is that when I try to run my app, Xcode gives me this error in the console.

请有人帮助我!我一整天都在做这件事。我已经看到几个不同的计算器问题得到了这个问题的回答,但是我已经尝试了所有方法,但我就是想不通。这是我的整个项目,所以我不必在这里粘贴多个文件的代码。问题是当我尝试运行我的应用程序时,Xcode 在控制台中给了我这个错误。

2012-04-23 17:28:33.638 KMLViewer[96646:11603] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIApplication 0x6d8d5e0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key pageControl.'
*** First throw call stack:
(0x114c022 0x12ddcd6 0x114bee1 0xc5022 0x36f6b 0x36edb 0x51d50 0x59771a 0x114ddea 0x10b77f1 0x59626e 0x597eb7 0x374ce1 0x374ff8 0x37417f 0x383183 0x383c38 0x377634 0x1d46ef5 0x1120195 0x1084ff2 0x10838da 0x1082d84 0x1082c9b 0x373c65 0x375626 0x27bd 0x2735)
terminate called throwing an exception

Thanks for any help! Here's the link to download it: http://www.mediafire.com/?4rd4xy8of1yv4ea

谢谢你的帮助!这是下载它的链接:http: //www.mediafire.com/?4rd4xy8of1yv4ea

回答by Andy Obusek

Your Class definition in OneTranquille.xib is wrong. It shows "KMLViewerViewController" but it should be "OneTranquille"

您在 OneTranquille.xib 中的类定义是错误的。它显示“KMLViewerViewController”但它应该是“OneTranquille”

回答by GoZoner

The error shows that the pageControl setter is being called on a UIApplication object but it is defined on your UIScrolView_... class. This indicates a mixup between two class names; one place where this is common is in nib files. It turns out that your 'Main nib file base name' (located in the Info settings for the KMLViewer target) is wrong - it should be MainWindow. Once you fix that - the application runs a bit further but runs into a 'map' setter problem (which is probably fixed by @obuseme's response).

该错误表明 pageControl setter 正在 UIApplication 对象上调用,但它是在您的 UIScrolView_... 类上定义的。这表示两个类名之间的混淆;一个常见的地方是在 nib 文件中。事实证明,您的“主要 nib 文件基本名称”(位于 KMLViewer 目标的信息设置中)是错误的 - 它应该是 MainWindow。一旦你解决了这个问题 - 应用程序运行得更远,但遇到了“地图”设置器问题(这可能已由@obuseme 的响应修复)。

回答by masterof

A further error may be a wrong or unnecessary Outlet named pagecontrol. Take a look at the outlets in the connection inspector.

另一个错误可能是名为 pagecontrol 的错误或不必要的 Outlet。查看连接检查器中的插座。