> For the complete documentation index, see [llms.txt](https://ryukiedev.gitbook.io/wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ryukiedev.gitbook.io/wiki/ios/runtime/runtime-zhong-xie-description-da-yin-dui-xiang-xin-xi.md).

# 04.重写description打印对象信息

```
-(NSString *)description
{
    NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
    uint count;
    objc_property_t *properties = class_copyPropertyList([self class], &count);

    for (int i = 0; i<count; i++) {
        objc_property_t property = properties[i];
        NSString *name = @(property_getName(property));
        id value = [self valueForKey:name]?:@"nil";      
       [dictionary setObject:value forKey:name];
    }

    free(properties);
    return [NSString stringWithFormat:@"<%@: %p> -- %@",[self class],self,dictionary];
}
```
