Xcode 4 和错误的“语义问题” - 如何对付他们?
我已经开始使用 Xcode 4,我真的对一些“功能”感到恼火,尤其是那些似乎没有多大意义的语义警告,例如:
http://coding- Journal.com/wp-content/uploads/2011/08/Screen-Shot-2011-08-07-at-8.50.46-PM.png
在第 640 行,您可以看到一个语义问题,说我将不兼容的指针类型传递给 NSString *
的参数,这完全是错误的,因为 NSTabViewItems 的 initWithIdentifier:< /code> 是:
- (id)initWithIdentifier:(id)identifier
我的猜测是 Xcode 认为我在其他对象上调用 initWithIdentifer:
,因为当我 Cmd+Click
该方法时,它给了我三个选项:
http://coding- Journal.com/wp-content/uploads/2011/08/Screen-Shot-2011-08-07-at-8.50.24-PM.png
第一个来自 NSTableColumn,具有签名
- (id)initWithIdentifier:(NSString *)identifier;
所以我的问题是,在这种情况下我该怎么办?我喜欢我的代码没有警告,但这在使用 Xcode 4 时似乎不可能:(
I've started using Xcode 4, and I'm really annoyed by some of the "features" especially those semantic warnings which don't seem to be making much sense, for example:
http://coding-journal.com/wp-content/uploads/2011/08/Screen-Shot-2011-08-07-at-8.50.46-PM.png
On line 640, you can see a semantic issue saying that I am passing an incompatible pointer type to a parameter of NSString *
, which is just plain wrong because the signature of NSTabViewItems' initWithIdentifier:
is:
- (id)initWithIdentifier:(id)identifier
My guess is that Xcode thinks that I am calling initWithIdentifer:
on some other object, because when I Cmd+Click
the method, it gives me three options:
http://coding-journal.com/wp-content/uploads/2011/08/Screen-Shot-2011-08-07-at-8.50.24-PM.png
And the first one, from NSTableColumn, has the signature
- (id)initWithIdentifier:(NSString *)identifier;
So my question is, what do I do in this situation? I like my code warning-free, but this doesn't seem to be possible when using Xcode 4 :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论