Note that there are some explanatory texts on larger screens.

plurals
  1. POEasy way to detect if I am using framework not available to older iOS
    primarykey
    data
    text
    <p>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. </p> <p>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.</p> <p>I thought I'd get that by using the compiler option: </p> <pre><code>-D__IPHONE_OS_VERSION_MAX_ALLOWED=__IPHONE_4_3 </code></pre> <p>but that ends up generating error in system header files, not my code.</p> <p>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.</p> <p>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).</p> <p>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...</p> <p>Here is a sample of what @mattjgalloway's answer did for me:</p> <p>Lumin App Group</p> <p>/Users/mz/Dev/Working/Lumin/Lumin/MyUIScreen.m</p> <ul> <li>'brightness' is deprecated: TOO NEW!</li> <li>'brightness' is deprecated: TOO NEW!</li> <li>'brightness' is deprecated: TOO NEW!</li> <li>'brightness' is deprecated: TOO NEW!</li> </ul> <p>/Users/mz/Dev/Working/Lumin/Lumin/LuminViewController+Share.m</p> <ul> <li>'TWTweetComposeViewController' is deprecated: TOO NEW!</li> <li>'TWTweetComposeViewController' is deprecated: TOO NEW!</li> <li>'TWTweetComposeViewController' is deprecated: TOO NEW!</li> </ul> <p>/Users/mz/Dev/Working/Lumin/Lumin/LuminViewController.m</p> <ul> <li>'scrollView' is deprecated: TOO NEW!</li> <li>'connectionWithMediaType:' is deprecated: TOO NEW!</li> <li>'connectionWithMediaType:' is deprecated: TOO NEW!</li> <li>'AVCaptureDeviceSubjectAreaDidChangeNotification' is deprecated: TOO NEW!</li> <li>'setSubjectAreaChangeMonitoringEnabled:' is deprecated: TOO NEW!</li> </ul> <p>Very nice.</p> <p>I placed the following in my project's .pch file, and am planning on doing so for all projects:</p> <pre><code>#if DEBUG #define __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED __IPHONE_OS_VERSION_MIN_REQUIRED #import "MJGAvailability.h" #endif </code></pre> <p>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.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload