如何在XIB文件中禁止Xcode“Attribute Unavailable”警告?

前端之家收集整理的这篇文章主要介绍了如何在XIB文件中禁止Xcode“Attribute Unavailable”警告?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我的应用程序的目标是10.6,并且所有.xib文件的“部署”值与之相比为10.6,最近更改为10.7(我不知道何时).如果我将其更改回10.6,我会收到来自 Xcode的以下警告:

/Users/andy/Source/.../Preferences.xib:383: Identifier on OS X versions prior to 10.7

这是.xib文件的相关部分:

381: <string key="NSFrame">{{1,1},{116,104}}</string>
382: <reference key="NSSuperview" ref="14642427"/>
383: <reference key="NSNextKeyView" ref="1001986100"/>
384: <string key="NSReuseIdentifierKey">_NS:11</string>

(事实上​​,当我在BBEdit中打开.xib以查看警告线然后关闭它并清理/构建Xcode时,被警告的线似乎发生了变化;它总是383但是内容会移动.上次警告发生在第383行的是NSSuperview线,至少可以说是奇怪的.

有时我会收到两个警告.另一个警告是:

file://localhost/Users/andy/Source/.../Preferences.xib: warning: Attribute Unavailable: Identifier on OS X versions prior to 10.7

当我点击它时,会突出显示.xib文件中的自定义视图.

谁能告诉我这个警告意味着什么以及我如何摆脱它?

我使用Xcode 4.4.1在10.8下开发,我认为这个警告在10.6下运行时会引起问题(我在开发过程中无法做到这一点).我很乐意根据需要提供其他信息.

解决方法

删除它:

1)选择XIB文件(编辑器打开)

2)按cmd opt 3打开相关XIB的Identity Inspector.然后按警告导航器中的警告 – 该警告应在NIB编辑器中选择违规对象.

3)清除Identity中的值>标识符(位于您指定自定义类的字段下方)

4)保存和构建.

应该这样做.

这是什么意思:

您正在使用10.6不支持的文档功能.

具体来说,它的键/值似乎与@protocol NSUserInterfaceItemIdentification相关联:

The NSUserInterfaceItemIdentification protocol is used to associate a
unique identifier with objects in your user interface. The protocol is
adopted by AppKit interface objects to support window restoration,
whereby information about window and other interface-related objects
is preserved and used to restore the application’s interface during
the next launch cycle.

在XIB中搜索的关键是userInterfaceItemIdentifier.

猜你在找的Xcode相关文章