Xcode 4.3 doesn't warn about undeclared methods when they exist in the current
@implementation
, which is a great new feature. However, this is causing an issue in certain circumstances when using my project on Xcode 4.2.
How do I re-enable the warnings for undeclared methods?
For example:
@interface MashTun : NSObject
- (void)foo;
@end
@implementation MashTun
- (void)foo {
CGRect rect = [self smallRect];
NSLog(@"My Small Rect: %@", NSStringFromCGRect(rect));
}
- (CGRect)smallRect {
return CGRectMake(0, 0, 100, 100);
}
@end
In Xcode 4.2, this fails:
warning: instance method '-smallRect' not found (return type defaults to 'id')
error: initializing 'CGRect' (aka 'struct CGRect') with an expression of incompatible type 'id'
I completely understand the warning and error in Xcode 4.2 since it's not allowing the search for methods within the current @implementation
scope. (The fix is simple: either put the smallRect
method above the foo
method, or declare the smallRect
method in a category or the header. )
But how do I turn on a warning in Xcode 4.3 to catch this error before passing it on to colleagues running 4.2?
Build Settings
forUndeclared Selector
? does this have any effect? – Juarez