Re: disable warning for override in category?
Re: disable warning for override in category?
- Subject: Re: disable warning for override in category?
- From: Marc Respass <email@hidden>
- Date: Thu, 16 Feb 2012 13:09:25 -0500
El feb 16, 2012, a las 12:55 p.m., Jens Alfke escribió: On Feb 16, 2012, at 8:12 AM, Marc Respass wrote:
I need to override a method in a category. I know I'm not supposed to do it but and I don't except in one place which is legacy code and I need it to keep working. Yesterday, everything was working fine. This morning, I upgraded to Xcode 4.3 and now I'm getting more warnings (warnings == errors) including
Wow, does that even work? I guess it’s not really a traditional OOP override, rather an overwrite, where the category method just replaces the original one entirely. I’ll take your word for it that you need this; it sounds dangerous :o
It did work! I agree that it is dangerous and it violates our policy which includes deprecations are warnings and warnings == errors. But I need it for this one case. It's on NSComboBoxCell and makes autocomplete case insensitive. There may be a better way to do that without subclassing but this is a few years old now so I just wanted to keep everything working. category is implementing a method which will also be implemented by its primary class [-Werror,-Wobjc-protocol-method-implementation]
I cannot find anything on -Wobjc-protocol-method-implementation anywhere. What I am hoping to do is disable the warning on just that class but I don't know what the compiler flag is.
That _is_ the compiler flag :)
Yea :) To disable it, you’d add the opposite flag, which I believe would be -Wno-objc-protocol-method-implementation. You can set it for just that source file by going into the Build Stages tab for that target, opening up the list of source files, and double-clicking near the right edge of the list item for that file.
Ah! Many thanks. Is there some place where I can find those compiler flags? I looked on Bing, Google, Apple's Dev site, and Xcode docs within Xcode 4.3 and came up empty every time. I wasn't sure what to search for. I tried "Wobjc-protocol-method-implementation" and "GCC Compiler Flags". I admit that this is not something I do a lot. I stay within Xcode checking and unchecking boxes.
I prefer the change for the file in Build Stages to the pragma so I did that and adding -Wno-objc-protocol-method-implementation also worked.
Thanks a lot everyone Marc |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden