获取未知类的所有方法

Class themeClass = NSClassFromString(@"YourClassName");
    unsigned int outCount = 0;
    Method *methodList = class_copyMethodList(themeClass, &outCount);
    for (int i = 0; i < outCount; i++) {
        Method method = methodList[i];
        const char *name = sel_getName(method_getName(method));
        NSLog(@"method: %s", name);
    }

    id manager = [[themeClass alloc] init];
    //po [manager _methodDescription]

    NSObject *theme = [pkClass performSelector:@selector(sharedThemeManager)];
    if (theme) {
        NSLog(@"available");
    }

你可能感兴趣的:(获取未知类的所有方法)