Implicit conversion of 'int' to 'id' is disallowed with ARC

来源:互联网 发布:中俄大桥 知乎 编辑:程序博客网 时间:2024/06/07 00:24
  1. NSMutableDictionary *dic = [typeArray objectAtIndex:1];  
  2.   NSString *typeName = [dic objectForKey:@"type"];  
  3. NSMutableDictionary *infoDic = [dic objectForKey:@"dic"];  
  4. //---------------------------------------------------出错----------------------------------------------------------------------  
  5. NSLog(@"当前cell的InfoDic==%@",infoDic);  
  6. NSMutableArray *allItem = [[NSMutableArray alloc] init];  
  7. for (int i=0; i<[infoDic count]; i++) {  
  8.     NSDictionary *contentOfDic = [infoDic objectForKey:[NSNumber numberWithInt:i]];  
  9.     NSString *name = [contentOfDic objectForKey:@"sender"];  
  10.     [allItem addObject:name];  
  11. }  

NSMutableDictionary中获取key值为int类型的value必须要进行NSNumber转换[NSNumber numberWithInt:i] 否者会报标题上得错误

转自:http://blog.csdn.net/mideveloper/article/details/12904567

0 0