Dynamic forwarding: suppress Incomplete Implementation warning
You can suppress Incomplete Implementation
warnings by adding
#pragma clang diagnostic ignored "-Wincomplete-implementation"
just above the @implementation
Hope this helps
EDIT
After being told in the comments that this didn't work for someone and finding out the reason was because it was a different warning they were getting I have done a bit of playing around and been able to solve there issue to so I thought I would update this answer to include theirs and for GCC
ignores as well. So for the issue for @Tony
the following should work
#pragma clang diagnostic ignored "-Wprotocol"
For anyone wanting to know the GCC
compiler version it is
#pragma GCC diagnostic ignored "-Wprotocol"
#pragma GCC diagnostic ignored "-Wincomplete-implementation"
I will also make a point that all these diagnotstic ignores
can also be done by specifying the setting on a per file basis by going to XCODE Project >> Target >> Build Phases >> Compile Sources
and adding a compiler-flag so you would just add -Wprotocol
or Wincomplete-implementation
or whatever compiler-flag you needed.
Hope this update helps all if anymore need I will update my answer to include.
EDIT 2
I was doing a bit more digging around about this an came across the Clang Compliler User's Manual so I thought that this would be interesting and helpful to anyone having issues around this area still.
I have also found another way that you can use these #pragma diagnostic ignores
and that is you can push
and pop
them so if you wanted to just ignore a particular section of the file and not all of it then you could do the following
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmultichar"
// And pop the warning is gone.
char b = 'fa';
#pragma clang diagnostic pop
Remember that all these #pragma
compile ignores can be used with GCC
as well so the above would
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmultichar"
// And pop the warning is gone.
char b = 'fa';
#pragma GCC diagnostic pop
The push
and pop
seem to work with all the diagnostic ignores
I have tried so far.
Another one is
#pragma clang diagnostic ignored "UnresolvedMessage"
#pragma GCC diagnostic ignored "UnresolvedMessage"
The one for suppressing unused variables is
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-variable"
NSString *myUnusedVariable;
#pragma clang diagnostic pop
and the GCC version being
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-variable"
NSString *myUnusedVariable;
#pragma GCC diagnostic pop
A few more for ignoring warnings from unavailableInDeploymentTarget
#pragma clang diagnostic push
#pragma ide diagnostic ignored "UnavailableInDeploymentTarget"
leftEdge.barTintColor = rightEdge.barTintColor = self.toolbar.barTintColor;
#pragma clang diagnostic pop
and performSelector leaks
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
[target performSelector:cancelAction withObject:origin];
#pragma clang diagnostic pop
and deprecated declarations
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
button = [[UIBarButtonItem alloc] initWithTitle:buttonTitle style:UIBarButtonItemStyleBordered target:self action:@selector(customButtonPressed:)];
#pragma clang diagnostic pop
Thanks to DanSkeel
you can find the entire list here
You can declare the methods in a class category interface:
@interface MyClass (ForwardedMethods)
- (void)doSomething;
@end
(without an implementation for the category). Then Xcode will not complain about "incomplete implementation" anymore.