NSCoding warning for unstable Swift class names shouldn't fire when using classForKeyedUnarchiver

Originator:jediknil
Number:rdar://FB9537094 Date Originated:2021-08-19
Status:Open Resolved:
Product:Foundation Product Version:
Classification:Incorrect/Unexpected Behavior Reproducible:
 
If you build and run the attached test case on macOS Catalina (10.15.7), there will be two sets of logs for using NSCoding with Swift classes with unstable runtime names. However, in the “Good” case, the unstable runtime name does not appear in the archive; instead, it’s only relevant because the base class’s +classForKeyedUnarchiver is the private subclass. (Note that the “Good” subclass does not get a warning on archive due to its use of -classForCoder, while the “Bad” subclass does.) The class whose name should be checked is the one +classForKeyedUnarchiver is called on, not the class that gets returned.

Note that on macOS Big Sur 11.5.2, this warning appears to have been removed. Was that intentional? If so, this report can be closed; if not, that should probably be fixed!

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!