[英]Xcode 8 no warning for assigning NSString to NSInteger?
I'm not sure when this started but it seems like Xcode is not giving me type mismatch warnings/errors like it used to.我不确定这是什么时候开始的,但似乎 Xcode 没有像以前那样给我类型不匹配的警告/错误。 For example, I just discovered a bug in my code where I was assigning the result of a method that returns NSString *
to an NSInteger
.例如,我刚刚在我的代码中发现了一个错误,我将返回NSString *
的方法的结果分配给NSInteger
。 The method prototype is correctly defined but the compiler gave no warning.方法原型被正确定义,但编译器没有给出警告。 Here is the code:这是代码:
+ (NSString *)countryDialPrefix;
NSInteger prefix = [CountryCodes countryDialPrefix];
Here are the warnings set for all languages:以下是为所有语言设置的警告:
This was in "Other Warning Flags" at the Project level:这是在项目级别的“其他警告标志”中:
-w -Xanalyzer -analyzer-disable-checker -Xanalyzer unix
So I removed the -w and that fixed it.所以我删除了 -w 并修复了它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.