Documentation for UINib doesnt include warning about availability checks

Originator:cbowns
Number:rdar://11799078 Date Originated:7/3/2012
Status:Open Resolved:
Product:Documentation Product Version:
Classification: Reproducible:N/A
 
Title:
Documentation for UINib doesn’t include warning about availability checks

Summary:
The release notes for iOS 4.0 include a very important note about runtime checking for the availability of UINib:

"iOS 4 includes a new UINib class to support rapidly unarchiving nib files. While this class is new to iOS SDK 4, it was present but private, in previous releases. Special care needs to be taken when deploying code that uses the UINib class and also runs on iOS releases prior to version 4. Specifically, you cannot determine the availability of the class solely using the NSClassFromString function, because that check returns a private class on iOS 3.x and earlier. Instead, after getting the UINib class using NSClassFromString, you must also use the respondsToSelector: method of the returned class to see if it responds to the nibWithNibName:bundle: method. If it responds to that method, you can use the class."

This warning appears nowhere in the documentation for UINib. It should.


Expected Results:
This type of exception to the class availability checks is normally documented in the class docs. UIGestureRecognizer includes the following text, for example:

"Usage Special Considerations
To determine whether a class is available at runtime in a given iOS release, you typically check whether the class is nil. Unfortunately, this test is not cleanly accurate for UIGestureRecognizer. Although this class was publicly available starting with iOS 3.2, it was in development a short period prior to that. Although the class exists in an earlier release, use of it and other gesture-recognizer classes are not supported in that earlier release. You should not attempt to use instances of those classes.

To determine at runtime whether you can use gesture recognizers in your application, test whether the class exists and, if it does, allocate an instance and see check if it responds to the selector locationInView:. This method was not added to the class until iOS 3.2. The code might look like the following:"


Actual Results:
UINib doesn't ever mention that you will have a terrible time if you use NSClassFromString to check for its availability.

Comments


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!