I want to use #pragma
(in Xcode) to suppress the warning:
warning: instance method \'-someMethod\' not found (return type defaults to \'id\'
OK, me again :) I tried various 'clang' specific #pragma
s but nothing worked, and only thing I could think of was to declare the method as a 'private method' from within the class that actually uses the method, thus:
main.m:
#import
#import "PragmaTest.h"
@interface PragmaTest ()
- (void)noSuchMethod;
@end
int main(int argc, const char * argv[])
{
@autoreleasepool {
PragmaTest *pragmaTest = [[PragmaTest alloc] init];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wall"
[pragmaTest noSuchMethod];
#pragma clang diagnostic pop
[pragmaTest release];
// insert code here...
NSLog(@"Hello, World!");
}
return 0;
}
PragmaTest.h:
#import
@interface PragmaTest : NSObject
@end
PragmaTest.m:
#import "PragmaTest.h"
@implementation PragmaTest
- (void)noSuchMethod
{
NSLog(@"noSuchMethod");
}
@end
I hope this meets your requirements and although it's not a solution involving #pragma
s I hope you won't feel the need to downvote a helpful answer.