• 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: Why use NSClassWithString?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why use NSClassWithString?


  • Subject: Re: Why use NSClassWithString?
  • From: Chris Hanson <email@hidden>
  • Date: Fri, 15 Aug 2003 15:13:52 -0500

On Friday, August 15, 2003, at 02:07 PM, Seth Willits wrote:
I was trying to figure out how to use a NSAppleScript object to execute an AppleScript, but the selector initWithSource: wasn't working until I found a small portion of an example on the Stone site which used NSClassWithString. Why does it have to be done this way?

One reason to do this is if you need to run on 10.1, where NSAppleScript isn't available. If you write your code like this:

NSAppleScript *myScript
= [[[NSAppleScript alloc] initWithSource:myScript] autorelease];

then it creates compile-time dependency on the NSAppleScript class. So when you try to run your application on 10.1 it'll fail dynamic linking, because Foundation in 10.1 doesn't include NSAppleScript.

That's my guess as to why his example does it anyway. If you're only concerned about 10.2 and later, then I wouldn't worry about it.

-- Chris

--
Chris Hanson, bDistributed.com, Inc. | Email: email@hidden
Custom Mac OS X Development | Phone: +1-847-372-3955
http://bdistributed.com/ | Fax: +1-847-589-3738
http://bdistributed.com/Articles/ | Personal Email: email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Why use NSClassWithString?
      • From: Seth Willits <email@hidden>
References: 
 >Why use NSClassWithString? (From: Seth Willits <email@hidden>)

  • Prev by Date: Re: Dynamic menu building
  • Next by Date: Cocoa Speech Wrapper?
  • Previous by thread: Why use NSClassWithString?
  • Next by thread: Re: Why use NSClassWithString?
  • Index(es):
    • Date
    • Thread