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

Categories

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

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

1 Answer

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...