ios类\u copyPropertyList返回较少的计数属性
我在函数中调用类\ uCopyPropertyListios类\u copyPropertyList返回较少的计数属性,ios,objective-c,runtime,Ios,Objective C,Runtime,我在函数中调用类\ uCopyPropertyList + (NSDictionary *)classPropsFor:(Class)klass{ if (klass == NULL) { return nil; } NSMutableDictionary *results = [[NSMutableDictionary alloc] init] ; unsigned int outCount, i; objc_property_t *
+ (NSDictionary *)classPropsFor:(Class)klass{
if (klass == NULL) {
return nil;
}
NSMutableDictionary *results = [[NSMutableDictionary alloc] init] ;
unsigned int outCount, i;
objc_property_t *properties = class_copyPropertyList(klass, &outCount);
for (i = 0; i < outCount; i++) {
objc_property_t property = properties[i];
const char *propName = property_getName(property);
if(propName) {
const char *propType = getPropertyType(property);
NSString *propertyName = [NSString stringWithUTF8String:propName];
NSString *propertyType = [NSString stringWithUTF8String:propType];
if (propertyType != nil){
[results setObject:propertyType forKey:propertyName];
}
}
}
free(properties);
// returning a copy here to make sure the dictionary is immutable
return [NSDictionary dictionaryWithDictionary:results];
}
但以具有2个属性的类为例,它会获得不同的属性计数列表:一次0计数,另一次2计数,另一次1计数
为什么?
这发生在iOS 7上可能是因为:问题是运行时返回NSNumber