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 9149655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:30:24+00:00 2026-06-17T11:30:24+00:00

I’m using Xcode 4.5. In my latest Xcode project, I have this warning pop

  • 0

I’m using Xcode 4.5.
In my latest Xcode project, I have this warning pop up when i build/compile my program:

Category is implementing a method which will also be implemented by its primary class

This is my code that is causing the error:

 @implementation NSApplication (SDLApplication)
 - (void)terminate:(id)sender {
    SDL_Event event;
    event.type = SDL_QUIT;
    SDL_PushEvent(&event); }
 @end

I have made it so the compiler ignores (or skips over) the warning generate using pragma code.

So my code now looks like this:

 @implementation NSApplication (SDLApplication)

 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wobjc-protocol-method-implementation"
 - (void)terminate:(id)sender{
   SDL_Event event;
   event.type = SDL_QUIT;
   SDL_PushEvent(&event);}
 #pragma clang diagnostic pop
 @end

Obviously it does the job and once built/compiled, no warning is generated.

My question is, is this a safe/ok way to suppress or ignore the warning in this way?

I read on some threads that using subclasses were advantageous, but there were many people fore and against using them in this way… I’d appreciate your thoughts 🙂

  • 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-17T11:30:25+00:00Added an answer on June 17, 2026 at 11:30 am

    “I read on some threads that using subclasses were advantageous…”

    Using subclasses may be advantageous but that’s not what you are doing here.

    What you have done is implemented an (SDLApplication) Objective-C Category on NSApplication. In that category, you are overriding NSApplication‘s terminate: method. In general, you should use categories only to add additional methods to an existing class, not to override existing methods, as that can have unpredictable results.

    What you really should do is subclass NSApplication so that you can override terminate: properly:

    @interface SDLApplication : NSApplication {
    
    }
    
    @end
    
    
    @implementation
    
    - (void)terminate:(id)sender {
       SDL_Event event;
       event.type = SDL_QUIT;
       SDL_PushEvent(&event);
       [super terminate:sender]; // this line is the key to assuring proper behavior
    }
    
    @end
    

    The last step in your overridden terminate: method should be a call to super, so that the terminate method works as it should. (Using the keyword super in a category is not allowed; only the word self, which is why there’s a need for subclassing).

    Make sure you also change the value for the NSPrincipalClass key in your Info.plist file to be SDLApplication instead of NSApplication.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have thousands of HTML files to process using Groovy/Java and I need to
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I am using JSon response to parse title,date content and thumbnail images and place

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.