Re: Why am I getting May Not Respond warnings for Super
Re: Why am I getting May Not Respond warnings for Super
- Subject: Re: Why am I getting May Not Respond warnings for Super
- From: Chris Tracewell <email@hidden>
- Date: Thu, 21 Jul 2011 12:33:45 -0700
On Jul 21, 2011, at 9:33 AM, Nick Zitzmann wrote:
>
> On Jul 21, 2011, at 9:51 AM, Chris Tracewell wrote:
>
>> I have a private framework that is included in a project. Many of the project classes descend from a class in the framework. All of these descendent classes implement copyWithZone, encodeWithCoder and initWithCoder and thus respectively calls each on super. I get warnings stating that "MySuperClass may not respond to -copyWithZone" and so on. I do declare each of these methods in super's header file, so why might these errors be getting triggered?
>
>
> I don't know whether it will make a difference or not, but one thing you ought to try is instead of declaring the methods in the header file, you should declare the class's compliance with the proper protocols (NSCopying and NSCoding in this case). That's the proper way of declaring support for copying and coding. It's a little different from C++, you see.
>
> Nick Zitzmann
> <http://www.chronosnet.com/>
Nick,
Thanks, that did it. Added the protocol declarations in the interface and it cleared things up. For future reference you need to add the declaration of protocol conformity like so...
@interface MyClass : NSObject <NSCopying>
You can comma separate multiple protocols.
--Chris_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden