利用objc_getClassList输出项目所有类
by 伍雪颖
int numClasses;
Class *classes =
NULL;
classes = NULL;
numClasses = objc_getClassList(NULL,
0);
NSLog(@"Number of classes: %d",
numClasses);
if (numClasses >
0 )
{
classes = (__unsafe_unretained Class *)malloc(sizeof(Class)
* numClasses);
numClasses = objc_getClassList(classes, numClasses);
for (int
i = 0; i < numClasses; i++) {
NSLog(@"Class name: %s",
class_getName(classes[i]));
}
free(classes);
}
时间: 2024-10-08 05:51:41