After upgrading to Xcode 4.6 my iOS projects that use code generated by SUP 2.1.3 started showing hundreds of warning messages in the generated code (in my project over 300 warnings). “<some parameter> used as the name of the previous parameter rather than as part of the selector”.
After a short Google search I have found a way to suppress the warning messages, as correcting the issues in generated code is not really an option. I thought I would write a short blog post to maybe help you guys out.
As of this release Apple has started warning developers if the method definitions are malformed. As the errors are in generated code we cannot solve the issue that would remove the warnings. For this SAP will have to release a patch for the code generator.
It turns out suppressing the warnings is relatively easy. By including the following statement the warnings are suppressed.
#pragma clang diagnostic ignored “-Wmissing-selector-name”
But as there are a lot of files with warnings it is easier to include the file in the pre compiled headers of your project. Look for the .pch file in the Supporting files folder in your project and include the #pragma line. If you are using a separate non ARC library in your ARC project for the generated classes you will need to include the line in the .pch file for both targets.
By including the #pragma line in the .pch files it is applied to all classes in the project and the warning messages should disappear. Please note that this will suppress all warnings of this type including if they are in your own (non generated) code. But as long as SAP does not release a patch to fix the code generation this will at least hide those nasty warnings in the generated files for now.
Happy coding everybody!
Many thanks to Rene Dohan over at stackoverflow for providing the solution for this problem.