/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
谁能告诉我这个警告意味着什么以及我如何摆脱它?
我使用Xcode 4.4.1在10.8下开发,我认为这个警告在10.6下运行时会引起问题(我在开发过程中无法做到这一点).我很乐意根据需要提供其他信息.
解决方法
1)选择XIB文件(编辑器打开)
2)按cmd opt 3打开相关XIB的Identity Inspector.然后按警告导航器中的警告 – 该警告应在NIB编辑器中选择违规对象.
3)清除Identity中的值>标识符(位于您指定自定义类的字段下方)
4)保存和构建.
应该这样做.
这是什么意思:
具体来说,它的键/值似乎与@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.