直接添加一个分类输出中文 在PrefixHeader.pch import即可。
//NSArray+Log.h
#import <Foundation/Foundation.h>
@interface NSArray (Log)
- (NSString *)descriptionWithLocale:(id)locale;
@end
@interface NSDictionary (Log)
- (NSString *)descriptionWithLocale:(id)locale;
@end
//NSArray+Log.m
#import "NSArray+Log.h"
@implementation NSArray (Log)
- (NSString *)descriptionWithLocale:(id)locale
{
NSMutableString *strM = [NSMutableString stringWithString:@"(\n"];
for (id obj in self) {
[strM appendFormat:@"\t%@,\n", obj];
}
[strM appendString:@")\n"];
return strM;
}
@end
@implementation NSDictionary (Log)
- (NSString *)descriptionWithLocale:(id)locale
{
NSMutableString *strM = [NSMutableString stringWithString:@"{\n"];
[self enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
[strM appendFormat:@"\t%@ = %@;\n", key, obj];
}];
[strM appendString:@"}\n"];
return strM;
}
@end