-Wpartial-availability and respondsToSelector: don't cancel each other out

Originator:tony
Number:rdar://24141126 Date Originated:12-Jan-2016 12:07 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode Version 7.3 beta (7D111g) / OS X Version 10.11.2 (15C50)
Classification:Serious Bug Reproducible:Always
 
I have a project that targets iOS 8.0, but has been using respondsToSelector: to use newer methods on iOS 8.2 classes (specifically `[UIFont systemFontOfSize:… weight:…]`).

Unfortunately under Xcode 7.3b1 this doesn't prevent the warning "'systemFontOfSize:weight:" is partial: introduced in iOS 8.2" from showing.

I've attached a sample project demonstrating the issue — of note are the customised WARNING_CFLAGS for the project.

https://dl.dropboxusercontent.com/u/153352/Radars/24141126/Availability%20Demo.zip

Comments

FYI: respondsToSelector: or runtime inspection is not recommended anymore for compatibility checking. See https://developer.apple.com/videos/play/wwdc2015/411/ at 11:35

For example: methods or classes can privately exist and be incomplete/broken before being officially stable/exposed, and this happens more often than one may think. The runtime lies. The equivalent check to what Swift has in my mind would be to query for the OS or framework version.

I'm only taking a guess here, but perhaps analysis on various ways of detecting if a feature can be used would be too difficult and variable, and a new type of availability operation/syntax may have to be introduced, like they did with swift. I currently wrap certain parts of code with a clang ignore pragma to silence the warning.


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!