Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3481080
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:24:45+00:00 2026-05-18T10:24:45+00:00

In a Cocoa application, I’d like to use conditional compilation, like: #if MACOSX_DEPLOYMENT_TARGET <=

  • 0

In a Cocoa application, I’d like to use conditional compilation, like:

#if MACOSX_DEPLOYMENT_TARGET <= MAC_OS_X_VERSION_10_4    
    [[NSFileManager defaultManager] removeFileAtPath:path handler:nil];
#else
    [[NSFileManager defaultManager] removeItemAtPath:path error:NULL];
#endif

My hope is that this will avoid compiler warnings about removeFileAtPath: being deprecated when MACOSX_DEPLOYMENT_TARGET = 10.6, since it shouldn’t be compiling that line.

It doesn’t work.

When MACOSX_DEPLOYMENT_TARGET = 10.6 I get a warning that removeFileAtPath: is deprecated. But it shouldn’t be compiling that line, so it shouldn’t be warning about it having a deprecated method!

(I am setting MACOSX_DEPLOYMENT_TARGET in both the project build settings and the target build settings. I have BASE_SDK set to 10.6 and specify GCC 4.2 in both, too.)

What am I doing wrong? Do I have some fundamental misunderstanding of conditional compilation?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T10:24:45+00:00Added an answer on May 18, 2026 at 10:24 am

    MACOSX_DEPLOYMENT_TARGET is mostly used to perform a weak-linking. You should use MAC_OS_X_VERSION_MIN_REQUIRED instead to perform conditional compilation:

    #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
        [[NSFileManager defaultManager] removeFileAtPath:path handler:nil];
    #else
        [[NSFileManager defaultManager] removeItemAtPath:path error:NULL];
    #endif
    

    See Ensuring Backwards Binary Compatibility – Weak Linking and Availability Macros on Mac OS X from Apple for more examples.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a cocoa application that will be making heavy use of both
I have a protocol handler associated with my Cocoa application. [[NSAppleEventManager sharedAppleEventManager] setEventHandler:self andSelector:@selector(getUrl:withReplyEvent:)
In my OSX/Cocoa application, I'd like to detect when users are clicking on a
Is it possible to embed an application (like Preview, Pages etc) into a Cocoa
I am writing a Cocoa application with Mono embedded. I want to run and
I am developing a Cocoa application which communicates constantly with a web service to
How do you set your Cocoa application as the default web browser? I want
How can I dismiss dialog in Cocoa application when user presses Esc or Enter
I'm working on a Cocoa application, and I've run into a situation where I
I want to load some data from mysql into my cocoa application view before

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.