We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
比如在Model定义 school_code 这种带下划线的变量名会导致Carsh
The text was updated successfully, but these errors were encountered:
我也遇到了,怎么解决
Sorry, something went wrong.
目前有一取巧方法:在NSObject+Runtime.m文件的+(void)enumerateCls: propertyBlock:的实现代码改成: +(void)enumerateCls:(Class)cls propertyBlock:(void(^)(CoreProperty *p))propertyBlock{
unsigned int numIvars; //成员变量个数 Ivar *vars = class_copyIvarList(cls, &numIvars); //Ivar *vars = class_copyIvarList([UIView class], &numIvars); NSString *key=nil; NSString *type = nil; for(int i = 0; i < numIvars; i++) { //创建CoreProperty CoreProperty *p =[CoreProperty new]; Ivar thisIvar = vars[i]; key = [NSString stringWithUTF8String:ivar_getName(thisIvar)]; //获取成员变量的名字 if ([[key substringWithRange:NSMakeRange(0, 1)] isEqualToString:@"_"]) { key = [key substringFromIndex:1]; } //记录变量名 p.name = key; type = [NSString stringWithUTF8String:ivar_getTypeEncoding(thisIvar)]; //获取成员变量的数据类型 //处理并记录变量类型 p.code = type; propertyBlock(p); } free(vars);
}
添加了 if ([[key substringWithRange:NSMakeRange(0, 1)] isEqualToString:@"_"]) { key = [key substringFromIndex:1]; } 只去掉第一个 _
No branches or pull requests
比如在Model定义 school_code 这种带下划线的变量名会导致Carsh
The text was updated successfully, but these errors were encountered: