Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8846157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:54:37+00:00 2026-06-14T11:54:37+00:00

I recently had a case where someone added a parameter to an init method

  • 0

I recently had a case where someone added a parameter to an init method and broke another project that shared the code. Since it’s only a warning, nobody realized the app was broken, so I’m trying to turn only this warning into an error:

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

I’ve found that you can pass -Werror=foo in Other C Flags to the compiler in Xcode to turn a warning into the error, but I can’t seem to find what ‘foo’ should be. I’ve tried ‘undeclared-selectors’ but that only catches @selector cases. I’ve tried -Werror-implicit-function-declaration but that doesn’t seem to catch that case either.

I tried ‘inst-method-not-found’ and ‘instance-method-not-found’ after finding ‘warn_inst_method_not_found’ during a casual search of the huge clang source code.

Help … ?

Update:
Here’s an example you can compile (e.g. in CodeRunner) to see the warning: https://gist.github.com/4045701

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T11:54:38+00:00Added an answer on June 14, 2026 at 11:54 am

    The option you’re looking for is -Werror=objc-method-access. Clang explicitly tells you this right in the warning message, if you download and compile that gist you posted:

    % clang test.m -c
    test.m:13:21: warning: instance method '-initWithNum:' not found (return type
          defaults to 'id') [-Wobjc-method-access]
      ...theObj = [[MyClass alloc] initWithNum: [NSNumber numberWithInt: 15]];
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 warning generated.
    
    % clang test.m -Werror=objc-method-access -c  // ta-da!
    

    But in real-world situations I agree with all the commenters above: You should fix or suppress all compiler warnings. Your build should build cleanly all the time. Otherwise, as you so rightly observed, you won’t be able to distinguish real bugs from “the usual spam”.

    FWIW, here’s the version of Clang I’m using:

    $ clang --version
    clang version 3.2  (http://llvm.org/git/llvm 1503aba4a036f5394c7983417bc1e64613b2fc77)
    Target: x86_64-apple-darwin12.2.0
    Thread model: posix
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently inherited some code that someone else had written. I discovered that everywhere
I recently had to change my active directory account password. Ever since then I
I recently had an exchange with another C++ developer about the following use of
I recently had a hard drive crashed and lost all of my source code.
Recently, I had the need for a function that I could use to guarantee
Recently i had a case where i was trying to establish a p2p connection
Summary I recently had a conversation with the creator of a framework that one
We have recently started using git and had a nasty problem when someone committed
Current project recently had a mess of changes to the DB schema. These were
I've recently had a bit of code work perfectly on the simulator, and screw

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.