• 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
How to ignore Tiger-only category methods on Leopard
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to ignore Tiger-only category methods on Leopard


  • Subject: How to ignore Tiger-only category methods on Leopard
  • From: Keith Blount <email@hidden>
  • Date: Wed, 30 Jan 2008 14:00:13 -0800 (PST)

Hi,


I have an NSString category that defines and implements the following methods:


- (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement options:(unsigned)opts range:(NSRange)searchRange;

- (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement;



As of Leopard, though, both of these methods were introduced to the AppKit, so Leopard doesn't really need to use this category. It works fine - the category just overrides Leopard's implementation - but I would rather that Leopard's built-in methods were used when the app is run on Leopard rather than my category.


So, my question is, how do I have the preprocessor check the OS version so that it can skip these methods in an #if #endif block if the user is running Leopard?


Obviously, for stuff that should only be done on Tiger within methods, I can just use:


if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_4)



But this won't work in a preprocessor #if #endif block because the preprocessor doesn't understand it, and all the other methods listed for checking this in the docs have the same issue from what I can see.


Is there a way to have these category methods skipped on Leopard? It's not really a big deal if not, given that it all works as expected anyway, but I figured there must be something silly I'm missing here.


Thanks in advance and all the best,
Keith



      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page.
http://www.yahoo.com/r/hs
_______________________________________________

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: How to ignore Tiger-only category methods on Leopard
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: How Do Classes Respond to performSelector?
  • Next by Date: Re: Weird Altered Icon
  • Previous by thread: Re: How Do Classes Respond to performSelector?
  • Next by thread: Re: How to ignore Tiger-only category methods on Leopard
  • Index(es):
    • Date
    • Thread