//获取对象的所有属性,并将对象中的所有属性赋值为空,约束,需要先讲属性初始化一次,然后赋值
-(NSDictionary*)getAllProperties:(id)objectModel{
//创建字典 将属性放入字典key值中,然后将key值所对应的value值置为 空
NSMutableDictionary *allKeyDic = [NSMutableDictionary dictionary];
u_int count;
objc_property_t *properties = class_copyPropertyList([objectModel class], &count);
NSMutableArray *propertiesArray = [NSMutableArray arrayWithCapacity:count];
for (int i = 0; i < count; i ++) {
const char* propertyName = property_getName(properties[i]);
[propertiesArray addObject:[NSString stringWithUTF8String:propertyName]];
}
free(properties);
for (NSString *str in propertiesArray) {
NSString *value = @"";
[allKeyDic setObject:value forKey:str];
}
return allKeyDic;
}