Xcode 4中的插座连接异常 [英] Exception on outlet connections in Xcode 4

查看:48
本文介绍了Xcode 4中的插座连接异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Xcode 4中创建了一个新的iPhone项目,并从在Xcode 3中创建的旧项目中添加了一些文件(xib和类),效果很好.

I have created a new iPhone project in Xcode 4 and added some files (xib and classes) from an old project which was created in Xcode 3 which works fine.

项目编译正常,没有错误或警告.但是,当我尝试运行它时,我臭名昭著"NSUnknownKeyException原因:该类不符合密钥dateOutlet的编码值"错误.

The project compiles fine with no errors or warnings. However, when I try to run it I get the infamous "NSUnknownKeyException reason: class is not key value coding-compliant for the key dateOutlet" error.

当我打开XIB文件时,到dateOutlet的连接似乎还不错,但是为了安全起见,我还是删除并重新连接了.下次运行它时,我遇到了相同的错误,但是在另一个插座上,这使我认为连接出了点问题,我只需要重新连接一次即可.但是,我注意到,有时当我重新连接电源插座时,它会在我已经固定"的电源插座上发生故障.经过很多摆弄之后,我得出结论,重新连接并不能真正解决任何问题,只是当我对xib进行更改时,会随机选择下一个出现故障的出口(或者至少看起来如此).

When I opened the XIB file the connection to the dateOutlet seemed just fine, but I deleted and reconnected anyway just to be safe. Next time I ran it I got the same error but on another outlet which made me think that something went wrong with connections and I just needed to reconnect them again. However, I noticed that sometimes when I reconnected an outlet it would fail on an outlet which I had already ìfixedî. After a lot of fiddling I concluded that reconnecting didnít really fix anything, itís just that when I made changes to the xib the next failing outlet would be picked at random (or so it seems at least).

有人遇到过这个问题吗?我在Google上搜索了很多,但似乎都没有遇到这种确切的行为.我现在尝试在3台不同的机器上运行该项目,结果相同.

Has anybody experienced this problem? I have googled a lot but none seem to have encountered this exact behaviour. I have tried to run the project on 3 different machines now with the same result.

推荐答案

好,我找到了问题的根源.似乎在应用程序的目标中,主界面"设置为我的MainView(它是UIView的实例).我将其更改为MainWindow(由Xcode生成),并且一切正常.

Ok, I found out the source of the problem. It seems that in the Target for the app the "Main Interface" was set to my MainView which is an instance of UIView. I changed it to MainWindow (generated by Xcode) and all worked fine.

这篇关于Xcode 4中的插座连接异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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