• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: instance fails in its own class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: instance fails in its own class
      • From: N!K <email@hidden>
  • Prev by Date: instance fails in its own class
  • Next by Date: Re: Understanding the Run loop idea and the updating of controls during long operations
  • Previous by thread: instance fails in its own class
  • Next by thread: Re: instance fails in its own class
  • Index(es):
    • Date
    • Thread