• 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: Determining OS at Runtime
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Determining OS at Runtime


  • Subject: Re: Determining OS at Runtime
  • From: "Adam R. Maxwell" <email@hidden>
  • Date: Fri, 03 Jul 2009 10:22:21 -0700


On Jul 3, 2009, at 10:06 AM, Steve Christensen wrote:

For the case of a function, if you're deploying on 10.4 but using a 10.5 function, that function will be weak-linked so doing a runtime check is both faster and more accurate in determining whether a function exists or not. For a Cocoa class method, you could replace the test with a call to -respondsToSelector: to determine if it exists or not. In both cases you're taking a feature-based approach rather than a "I know this feature showed up in this OS version" approach.

Just as a caution, you may run across functions that don't have the appropriate weak attribute in the header, so you'll crash at launch time on 10.4 (this bit me recently with CFStringTokenizer, rdar://problem/6781636 ) So if you're checking function pointers against NULL, check the header to make sure they have the correct accessibility macro.


--
Adam

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

References: 
 >Determining OS at Runtime (From: iseecolors <email@hidden>)
 >Re: Determining OS at Runtime (From: Sherm Pendley <email@hidden>)
 >Re: Determining OS at Runtime (From: Steve Christensen <email@hidden>)
 >Re: Determining OS at Runtime (From: Andrew Farmer <email@hidden>)
 >Re: Determining OS at Runtime (From: Steve Christensen <email@hidden>)
 >Re: Determining OS at Runtime (From: Mark Munz <email@hidden>)
 >Re: Determining OS at Runtime (From: Steve Christensen <email@hidden>)

  • Prev by Date: Re: Determining OS at Runtime
  • Next by Date: Re: Determining OS at Runtime
  • Previous by thread: Re: Determining OS at Runtime
  • Next by thread: Re: Determining OS at Runtime
  • Index(es):
    • Date
    • Thread