I'm currently working on an NSProxy
subclass which intercepts certain messages and never forwards them to anyone but just processes them, so these methods never really exist. And here comes the problem, obviously the compiler starts to complain about the missing method implementations and I can't figure out how to stop it, adding stub methods to the interface just to get the compiler to shut up doesn't work because the methods are arbitrary formed and I don't know them ahead (to make it a bit more specific, I'm asking for this project).
Ideally I would like to tell the compiler that it shouldn't do any method checking for this specific class at all, but as this seems rather unlikely I would also be happy for a #pragma
or any other way (which doesn't include to shut the compiler up for every warning in the whole project/file!)
Your switch statements aren't really arbitrary, they just could have an arbitrary length. For a broad number of lengths, you could go ahead and declare them for the benefit of the compiler (and you'd then get error checking, which you wouldn't if you just turned off the warning). For example:
typedef void (^ObjCCaseBlock)();
@interface NSObject ()
- (id)switch;
- (void)case:(NSString*)a :(ObjCCaseBlock)b;
- (void)case:(NSString*)a :(ObjCCaseBlock)b case:(NSString*)a :(ObjCCaseBlock)b;
- (void)case:(NSString*)a :(ObjCCaseBlock)b case:(NSString*)a :(ObjCCaseBlock)b case:(NSString*)a :(ObjCCaseBlock)b;
@end
Repeat for as many levels as is likely to occur (and you could add levels if it ever bumped into a problem). It's a little bit tedious, but not difficult.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With