- (IBAction)JSONBUT:(UIButton *)sender
{
NSString *pathFile = [[NSBundle mainBundle]pathForResource:@"date2.txt" ofType:nil];
NSData *data = [NSData dataWithContentsOfFile:pathFile];
NSArray *array = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil];
self.dataArray = [NSMutableArray array];
for (NSDictionary *dic in array) {
Model *model = [[Model alloc]init];
[model setValuesForKeysWithDictionary:dic];
[self.dataArray addObject:model];
}
for (Model *m in self.dataArray) {
NSLog(@"%@%@%@%@", m.receiver, m.sender, m.date, m.content);
}
}