Re: instance fails in its own class
Re: instance fails in its own class
- Subject: Re: instance fails in its own class
- From: Greg Guerin <email@hidden>
- Date: Sat, 6 Nov 2010 23:25:04 -0700
N!K wrote:
However, exactly the same statement fails when pasted into -init of
Class.m.
Build yields "warnings Class may not respond to -new."
This message suggests you're calling an instance method, not a class
method, or that's the way the compiler is interpreting it.
Post your actual failing code, in the complete method where it fails.
For example, is your class really named Class? If so, then that
won't work. The reason is that Class is already a defined type, and
it doesn't descend from NSObject. See the return type of the
NSObject method -class. Look it up in "The Objective-C Programming
Language" reference doc, under the heading "Defined Types", or see
the include file "objc/objc.h".
Furthermore, since +new is defined as +alloc followed by -init,
calling +new in -init seems a little recursive to me, but without
seeing actual code, it's just a guess.
-- GG
_______________________________________________
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