Why does objc_copyClassNamesForImage yield both mangled and unmangled class names?

This is a screenshot of some of the results of calling objc_copyClassNamesForImage() on the iOS 12 App Store binary. Why are some mangled, while others are not?

The ObjC runtime will demangle "simple" names that consist of a non-private, non-generic top-level class (or protocol), on the grounds that people need to be able to use those for Interface Builder and other sources of dynamic lookup. But the canonical name of a Swift class (without a custom @objc name) is an old-style mangled name.

2 Likes

Thanks! Interesting.

Does this mean the demangled "simple" names will work with objc_getClass while demangled "complex" names won't?

Terms of Service

Privacy Policy

Cookie Policy