Detect unsupported SDK calls

Originator:robnapier
Number:rdar://11985733 Date Originated:30-Jul-2012
Status:Open Resolved:
Product: Product Version:
Classification: Reproducible:
 
Apple's advice for supporting older versions of the SDK is to set the deployment target, but link to the latest SDK. This is very dangerous in practice because if your program makes a call to a function that is not supported in your deployment target, you will get no warning, but it will crash at runtime. Neither the compiler nor the static analyzer will help protect you from this.

Apple's advice here is not useful, and developers in practice must link against the old SDK in order to avoid crashing.

Apple should provide a tool to detect SDK usage that is not compatible with the deployment target (including filtering out correct usage via weak linking, as Apple recommends). Until Apple can provide such a tool, Apple should stop removing old SDKs from Xcode.

Comments

More stable apps

Sometimes it's hard to keep track of older API calls. This check would quickly help developers fix plenty of crashes that could go unnoticed for a very long time.

By brunoresende29 at Oct. 10, 2016, 9:29 p.m. (reply...)

3 years later and still getting caught out by this...

Yep, just had a host of complaints from users that my latest update (built against 10.10 SDK, deployment 10.6) won't run on 10.6, despite that having been the deployment target since the first release back in January 2015.

Not a peep from Xcode's Analyser; in the embarrassing situation where I have to ask my users to provide console logs in the hope that I can figure out what changes I made last week caused the crash. :(

By applehelpwriter at July 14, 2015, 1:02 p.m. (reply...)

Xcode should not lie

If you set a deployment target, and what Xcode compiles won't run there, it should give an error.

I second this

Along with the other 8 developers I work with.

Filed dupe: rdar://12017796

By futuretap at Aug. 2, 2012, 6:05 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!