Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
686 views
in Technique[技术] by (71.8m points)

gcc - Using #pragma to suppress “Instance method not found” warnings in Xcode

I want to use #pragma (in Xcode) to suppress the warning:

warning: instance method '-someMethod' not found (return type defaults to 'id')

I've tried:

#pragma GCC diagnostic ignored "-Wmissing-declarations"

And several others, but nothing works.

What warning causes the "instance method not found"?

Edit

As requested here is the actual code:

...

if (sampleRate > 0 && ![self isFinishing])  //<--- Warning here
{
    return self.progress;
}

...

And the build log output:

/Users/User1/Documents/Project/branch/client/Folder/CodeFile.m:26:32:{26:32-26:50}: warning: instance method '-isFinishing' not    found (return type defaults to 'id') [3]
     if (sampleRate > 0 && ![self isFinishing])
                            ^~~~~~~~~~~~~~~~~~
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

See: https://stackoverflow.com/a/34043306/89035 for a #pragma to suppress "instance method not found" warnings.

While it seem that a true #pragma solution to this does not exist turning off the warnings in individual files can be accomplished by use of the -w switch.

NB: This solution is for Xcode 4.2 and above

  1. Select the target
  2. Click on the "Build Phases" tab
  3. Under "Compile Sources" add the -w switch to the file(s) you wish to suppress warnings on

Xcode - compile sources - suppress warnings


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...