Interface Builder中的死出口/操作出错 [英] Error on Dead Outlets / Actions in Interface Builder

查看:98
本文介绍了Interface Builder中的死出口/操作出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让Xcode拒绝构建应用程序,因为我的Xib,Nib或Storyboard中存在死机或动作?我经常构建一个应用程序只是为了发现崩溃,因为界面构建器文件指向我班上不再存在的键。

Is there a way to have Xcode refuse to build an app due to there being a dead outlet or action in my Xib, Nib or Storyboards ? I quite often build an app only to find it crashes due to a interface builder file is pointing to a key on my class which no longer exists.

我慢慢来结论是以编程方式构建这些UI更好,但我想知道是否有一种方法至少对于我的Xcode旧项目警告我反对这些事情?

I am slowly coming to the conclusion it is better to construct these pieces of UI programatically but I was wondering if there is a way at least for my older projects of Xcode warning me against these things ?

推荐答案

嗯,它不能。 Objective-C的本质是动态的,因此xib和代码之间的连接在编译/链接阶段无法确定。

Well, it can't. The nature of Objective-C is dynamic so the connection between xib and code can not be sure in the compile/link stage.

你可以实现

-(void)setValue:(id)value forUndefinedKey:(NSString *)key{ NSLog(@"Key:%@", key);}

找出遗漏的内容。 (缺少的网点最终会到达这里。)

To find out what is missing. (Missing outlets will finally reach here.)

这篇关于Interface Builder中的死出口/操作出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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