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

  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

你可能感兴趣的:(常见错误)