Making sure my code will run on Tiger 10.4 when I'm compiling on Leopard 10.5.

  • I've been running into some issues developing a project on Leopard
    (10.5.1) which I want to run on any version of Tiger (10.4.x) in
    addition to Leopard.  In Xcode, I've set my "Cross-Develop Using
    Target SDK:" to "Mac OS X 10.5" and set my "Mac OS X Deployment
    Target" to "Mac OS X 10.4."  This should, theoretically, allow me to
    use features present only in Leopard if I'm running on Leopard (like
    the new animator), but also still run normally on Tiger.

    Although this mostly seems to be working, I keep running into cases
    where I've accidentally called some bit of Apple code which isn't
    present until Leopard (NSURLRequestReloadIgnoringLocalCacheData was
    the last one).  I thought I was being pretty careful to check
    everything, but I of course managed to miss a few.  In order to figure
    out what I missed, I ended up setting the target SDK back to Tiger and
    compiling against that temporarily to see where the compiler
    complained.  This was a bit of a hassle since the compiler immediately
    got stuck on NSUInteger and didn't give any more errors, so I
    temporarily added the typedef to my code to force the compiler to move
    on to the next error.

    Anyhow, after the big rambling description, my question boils down to
    the following: is the method I described above the best way to make
    sure my code won't crash on Tiger, or am I missing some easier way?

    Thanks,

    -Ryan
  • On 11 Dec 2007, at 00:24, Ryan Poling wrote:

    > I've been running into some issues developing a project on Leopard
    > (10.5.1) which I want to run on any version of Tiger (10.4.x) in
    > addition to Leopard.  In Xcode, I've set my "Cross-Develop Using
    > Target SDK:" to "Mac OS X 10.5" and set my "Mac OS X Deployment
    > Target" to "Mac OS X 10.4."  This should, theoretically, allow me to
    > use features present only in Leopard if I'm running on Leopard (like
    > the new animator), but also still run normally on Tiger.
    >
    > Although this mostly seems to be working, I keep running into cases
    > where I've accidentally called some bit of Apple code which isn't
    > present until Leopard (NSURLRequestReloadIgnoringLocalCacheData was
    > the last one).

    I filed a bug report over two years ago now <rdar://4159295> asking
    for a mechanism to cause the compiler to warn about use of APIs newer
    than a specified version unless I took action to prevent it.

    The example I gave was something like

      if (<test for presence of API somehow>) {
        #pragma enable-api MACOSX_VERSION_10_5
        /* Use the 10.5 API here */
        #pragma enable-api
      } else {
        /* 10.4-compatible code here */
      }

    but obviously there are lots of choices that could be made about the
    syntax.

    I don't *think* this issue has been addressed; certainly my bug report
    is still open.  And in the absence of such a feature, your options are:

      1. Build against the Tiger SDK and don't use Leopard features at all.

      2. Put Leopard code in its own files, and use different settings
    for just those files.

      3. Do what you are doing now, plus *lots* of testing.

    My experience of developing simultaneously for 10.4 and 10.3, and
    before that for 10.3 and 10.2, leads me to conclude that this problem
    is something of a nuisance in practice, which is why I filed a bug
    report.

    (If you file a bug report on this as well, please refer to mine as it
    will make it easier for the people at Apple to see that there's more
    than one request for this type of feature.)

    Kind regards,

    Alastair.

    --
    http://alastairs-place.net
  • Thanks for the response - I'll definitely file at least a feature
    request with Apple about that - it would certainly be nice if they
    made it easier for us!

    -Ryan

    On Dec 11, 2007, at 2:59 AM, Alastair Houghton wrote:

    > I filed a bug report over two years ago now <rdar://4159295> asking
    > for a mechanism to cause the compiler to warn about use of APIs
    > newer than a specified version unless I took action to prevent it.
    >
    > The example I gave was something like
    >
    > if (<test for presence of API somehow>) {
    > #pragma enable-api MACOSX_VERSION_10_5
    > /* Use the 10.5 API here */
    > #pragma enable-api
    > } else {
    > /* 10.4-compatible code here */
    > }
    >
    > but obviously there are lots of choices that could be made about the
    > syntax.
    >
    > I don't *think* this issue has been addressed; certainly my bug
    > report is still open.  And in the absence of such a feature, your
    > options are:
    >
    > 1. Build against the Tiger SDK and don't use Leopard features at all.
    >
    > 2. Put Leopard code in its own files, and use different settings
    > for just those files.
    >
    > 3. Do what you are doing now, plus *lots* of testing.
    >
    > My experience of developing simultaneously for 10.4 and 10.3, and
    > before that for 10.3 and 10.2, leads me to conclude that this
    > problem is something of a nuisance in practice, which is why I filed
    > a bug report.
    >
    > (If you file a bug report on this as well, please refer to mine as
    > it will make it easier for the people at Apple to see that there's
    > more than one request for this type of feature.)
    >
    > Kind regards,
    >
    > Alastair.
    >
    > --
    > http://alastairs-place.net
previous month december 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Go to today