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 7807529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:52:44+00:00 2026-06-02T02:52:44+00:00

After a marathon coding session, where I added too much code without keeping track

  • 0

After a marathon coding session, where I added too much code without keeping track of everything, I now have an app that probably has some iOS 5.0 and 5.1 specific enums, calls and frameworks, however, I want my app to support iOSes back to 4.3.

I was hoping that there was an easy way of setting Xcode to compile as if it were compiling for iOS 4.3, so that I would get errors for all of the offending code that needs to be conditioned out, and/or alternatively coded, for older iOS.

I thought I’d get that by using the compiler option:

-D__IPHONE_OS_VERSION_MAX_ALLOWED=__IPHONE_4_3

but that ends up generating error in system header files, not my code.

Given that most enums and frameworks have their availability included in the header files, I have to think that there is an easy way to do what I need.

Has anyone managed to do such a thing without resorting to downloading older Xcodes with old SDKs? There I may run into the issue of Xcodes that won’t function properly under Lion (which is what I am running).

UPDATE: It appears as though I can’t install Xcode 3.2.6 on Lion. I now will have to find a Snow Leopard Mac, unless I find a way to use compiler options or forcing Xcode to use old SDKs…

Here is a sample of what @mattjgalloway’s answer did for me:

Lumin App Group

/Users/mz/Dev/Working/Lumin/Lumin/MyUIScreen.m

  • ‘brightness’ is deprecated: TOO NEW!
  • ‘brightness’ is deprecated: TOO NEW!
  • ‘brightness’ is deprecated: TOO NEW!
  • ‘brightness’ is deprecated: TOO NEW!

/Users/mz/Dev/Working/Lumin/Lumin/LuminViewController+Share.m

  • ‘TWTweetComposeViewController’ is deprecated: TOO NEW!
  • ‘TWTweetComposeViewController’ is deprecated: TOO NEW!
  • ‘TWTweetComposeViewController’ is deprecated: TOO NEW!

/Users/mz/Dev/Working/Lumin/Lumin/LuminViewController.m

  • ‘scrollView’ is deprecated: TOO NEW!
  • ‘connectionWithMediaType:’ is deprecated: TOO NEW!
  • ‘connectionWithMediaType:’ is deprecated: TOO NEW!
  • ‘AVCaptureDeviceSubjectAreaDidChangeNotification’ is deprecated: TOO NEW!
  • ‘setSubjectAreaChangeMonitoringEnabled:’ is deprecated: TOO NEW!

Very nice.

I placed the following in my project’s .pch file, and am planning on doing so for all projects:

#if DEBUG
#define __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED __IPHONE_OS_VERSION_MIN_REQUIRED
#import "MJGAvailability.h"
#endif

For any project, I am now automatically watching for SDK issues based on the earliest iOS I am targeting. While there still may be SDK changes I have to worry about, at least I know of most framework additions that are unavailable to an older iOS release.

  • 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-06-02T02:52:46+00:00Added an answer on June 2, 2026 at 2:52 am

    Take a look at my MJGAvailability.h here on GitHub. Basically it defines the right preprocessor #defines so that newer APIs will look like they’re deprecated, so you get a compiler warning. There’s some documentation at the top of the file, but basically you just do this in your PCH file:

    #define __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED __IPHONE_4_3
    #import "MJGAvailability.h"
    

    For if you want to support down to iOS 4.3.

    It’s certainly not 100% foolproof, but I find it incredibly useful for doing what you’re asking.

    If you want to suppress a warning because maybe you know that it’s OK to use that API (you’ve surrounded it with a respondsToSelector for example) then you can do something like this:

    UINavigationBar *navBar = self.navigationController.navigationBar;
    if ([navBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)]) {
    #pragma clang diagnostic push
    #pragma clang diagnostic ignored "-Wdeprecated-declarations"
        [navBar setBackgroundImage:[UIImage imageNamed:@"navbar_bg.png"] forBarMetrics:UIBarMetricsDefault];
    #pragma clang diagnostic pop
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After loosing much sleep I still cannot figure this out: The code below (its
After spliting a tab delimited file I have my required values in a string
After doing an AJAX call, am redirecting- using the following code. But, after AJAX
After running the Leaks Instruments on an app that I am developing, I see
After looking over the of the NHibernate.Envers code I realized I was implementing the
After going back to one of 'PHP Login System' test projects, I now need
After I have upgraded my localhost wamp server to php 5.3.10 , the var_dump
After Googling for awhile I didn't see an answer. Anyway I have a situation
After receiving push notification app icon not display badge. In setting notification is on,
After using the following code no errors are shown, but my database is not

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.