xcode升级到8.0以后,插件的使用收到限制,虽然通过某些办法也可以使用插件,可是在网上找的资料显示,使用插件有一定的几率是提交版本的时机出现问题,所以暂时只记录不使用插件使控制台显示中文的办法,
1,创建一个数组的类目,里面写一个方法
#import "NSArray+dailyRecordArray.h"
@implementation NSArray (dailyRecordArray)
-(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
2,创建一个字典的类目,里面写一个方法
#import "NSDictionary+dailyRecordDictionary.h"
@implementation NSDictionary (dailyRecordDictionary)
-(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
这两个方法都不用导入头文件,只需放到工程中即可
网友评论