Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在 iOS 4 上运行的应用程序中使用 iOS 5 中引入的一些类。我了解如何使用 respondsToSelector: 在较新的操作系统版本上选择性地调用新方法。在运行时确定类是否存在的等价物。
if (NSClassFromString(@"ClassName") != nil) { // use class } else { // not available, deal with it. }