什么是 Objective-C 运行时中的类处理程序回调?根据文档,
objc_getClass is different from objc_lookUpClass in that if the class is not registered, objc_getClass calls the class handler callback and then checks a second time to see whether the class is registered. objc_lookUpClass does not call the class handler callback.
最佳答案
它似乎是运行时的一个过时功能。在/usr/include/objc/runtime.h 中,您可以在标记为 /* Obsolete functions */
的部分中找到以下声明:
OBJC_EXPORT void objc_setClassHandler(int (*)(const char *)) OBJC2_UNAVAILABLE;
因此,显然,在 Objective-C 2.0 之前,可以注册一个函数指针来充当类处理程序。我猜参数是类名。它将有机会加载或动态创建命名类。
关于objective-c - 什么是 Objective-C 运行时中的类处理程序回调?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57934479/