0

Some old third party code gives warning:

Using 'stringWithString' with a literal is redundant

Instead of modifying the source codes, I'd prefer to disable the warning in Xcode. What is the compiler switch to disable this specific warning?

ohho
  • 50,879
  • 75
  • 256
  • 383
  • Why don't you want to modify the source? The use of stringWithString is hardly ever merited. – Hot Licks Oct 18 '13 at 07:40
  • Or, if you refuse to modify the source, perhaps the warning should be left there, to flag this poor practice for future maintenance. – Hot Licks Oct 18 '13 at 14:47

2 Answers2

2

The warning message should tell you the name of the warning. You can then turn that warning off.

test.m:4:5: warning: using 'stringWithString:' with a literal is redundant 
      [-Wobjc-redundant-literal-use]

so you want to add the flag -Wno-objc-redundant-literal-use to the compiler flags for that file or that project.

Greg Parker
  • 7,972
  • 2
  • 24
  • 21
-1

One way to do that is :

  1. Select your target .
  2. Go to the compiled sources.
  3. Select your .m file and set flag -w to suppress all the warning of that file .
V-Xtreme
  • 7,230
  • 9
  • 39
  • 79