Skip to Content
Author's profile photo Former Member

Suppress warnings in generated code after upgrade to Xcode 4.6

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”.

Screen Shot 2013-01-30 at 10.16.49 .png

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.

Screen Shot 2013-01-30 at 10.24.28 .png

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.

Assigned tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Paul Aschmann
      Paul Aschmann

      Thanks for sharing!

      Author's profile photo Former Member
      Former Member

      Thanks a lot Robert, 500+ warnings were making the build incredibly slow. I guess the real fix should be provided by SUP when they fix the method definitions in their libraries.

      Also, thanks Stackoverflow!

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      You're welcome. I guess it will take a while before the SUP libraries will be updated.