• 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: Trouble calling class_addIvar()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble calling class_addIvar()


  • Subject: Re: Trouble calling class_addIvar()
  • From: Kyle Sluder <email@hidden>
  • Date: Fri, 8 Oct 2010 17:12:28 -0700

On Fri, Oct 8, 2010 at 5:00 PM, Rick Mann <email@hidden> wrote:
> Yes, I read that. I had hoped that I'd be able to add ivars before the class was instantiated. In this case, the class is being loaded dynamically at run time. Is there no way to get in the middle of the load and add an ivar?
>
> In any case, sure seems like I ought to be able to do it in +initialize.

The documentation states you can't add ivars to classes that have
already been registered. In order for a class to receive +initialize,
it logically must already have been registered with the runtime.
Therefore, it's quite apparent why class_addIvar() can't be called
from +initialize.

The fact that you want to add instance variables to a class at all is
a terrible code smell. Like Fresh Kills Landfill bad. What are you
trying to achieve?

--Kyle Sluder
_______________________________________________

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: Trouble calling class_addIvar()
      • From: Rick Mann <email@hidden>
    • Re: Trouble calling class_addIvar()
      • From: Rick Mann <email@hidden>
    • Re: Trouble calling class_addIvar()
      • From: Rick Mann <email@hidden>
References: 
 >Trouble calling class_addIvar() (From: Rick Mann <email@hidden>)
 >Re: Trouble calling class_addIvar() (From: Kyle Sluder <email@hidden>)
 >Re: Trouble calling class_addIvar() (From: Rick Mann <email@hidden>)

  • Prev by Date: Re: Trouble calling class_addIvar()
  • Next by Date: Re: Trouble calling class_addIvar()
  • Previous by thread: Re: Trouble calling class_addIvar()
  • Next by thread: Re: Trouble calling class_addIvar()
  • Index(es):
    • Date
    • Thread