xcode 控制台输出中文

我是一个小白,所以每次只是给大家整理资料,今天项目中控制台打印的都看不懂,所以.....

#import "NSArray+decription.h"

@implementation NSArray (decription)

- (NSString *)descriptionWithLocale:(id)locale

{

NSMutableString *str = [NSMutableString stringWithFormat:@"%lu (\n", (unsigned long)self.count];

for (id obj in self) {

[str appendFormat:@"\t%@, \n", obj];

}

[str appendString:@")"];

return str;

}

@end

#import "NSDictionary+decription.h"

@implementation NSDictionary (decription)

- (NSString *)descriptionWithLocale:(id)locale

{

NSArray *allKeys = [self allKeys];

NSMutableString *str = [[NSMutableString alloc] initWithFormat:@"{\t\n "];

for (NSString *key in allKeys) {

id value= self[key];

[str appendFormat:@"\t \"%@\" = %@,\n",key, value];

}

[str appendString:@"}"];

return str;

}

@end


添加两个分类,数组和字典的分类就可以了 .

特别标注:转自 http://blog.csdn.net/chuan403082010/article/details/50562017

你可能感兴趣的:(xcode 控制台输出中文)