• 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: Basic runtime function usage - objc_getClass
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Basic runtime function usage - objc_getClass


  • Subject: Re: Basic runtime function usage - objc_getClass
  • From: Sherm Pendley <email@hidden>
  • Date: Wed, 23 Nov 2005 15:30:57 -0500

On Nov 23, 2005, at 1:43 PM, Damien Bobillot wrote:

Just a remark. The dedicated Cocoa function to do this is NSClassFromString :
Class MyClass = NSClassFromString(@"MyClass");

Quite right, but in some contexts it can be easier to call the runtime function. NSClassFromString() takes an NSString argument, so it's the one to call if an NSString is what you already have.


But, if you have a C string (passed to you from another language, for instance), there's not much point in creating an NSString object, passing it to NSClassFromString(), then releasing it. In that case it'd be easier to simply pass the C string directly to objc_getClass().

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Basic runtime function usage - objc_getClass (From: Francis Derive <email@hidden>)
 >Re: Basic runtime function usage - objc_getClass (From: Sherm Pendley <email@hidden>)
 >Re: Basic runtime function usage - objc_getClass (From: Damien Bobillot <email@hidden>)

  • Prev by Date: Re: Hiding method names in binary
  • Next by Date: Deprecated methods in NSDocument
  • Previous by thread: Re: Basic runtime function usage - objc_getClass
  • Next by thread: Re: Basic runtime function usage - objc_getClass
  • Index(es):
    • Date
    • Thread