解析字典包含关键字比如ID,description等,MJExtension 框架 不能直接设置变量与其同名。

@property (nonatomic,strong) NSString *descrip;  //设置变量名

 

 

 _DataReceived=(NSMutableArray *)[HZnewsmessage objectArrayWithKeyValuesArray:tempnews];

//上面利用MJExtension框架遍历都是通过变量名与KEY相同的情况,而关键字需要单独遍历    

    for (int i=0; i<tempnews.count; i++) {

            NSDictionary *temp_dic=[tempnews objectAtIndex:i];

            HZnewsmessage *temp_mesg=[_DataReceived objectAtIndex:i];

            temp_mesg.descrip=[temp_dic objectForKey:@"description"];

            [_DataReceived replaceObjectAtIndex:i withObject:temp_mesg];

            

        }

 

posted @ 2015-07-03 15:46  穿山甲随笔-iOS开发  阅读(927)  评论(0编辑  收藏  举报