Implicit conversion of 'int&

2016-01-27  本文已影响4147人  蛐蛐_
    NSMutableDictionary *dic = [typeArray objectAtIndex:1];
//    NSString *typeName = [dic objectForKey:@"type"];
    NSMutableDictionary *infoDic = [dic objectForKey:@"dic"];
    //---------------------------------------------------出错----------------------------------------------------------------------
    NSLog(@"当前cell的InfoDic==%@",infoDic);
    NSMutableArray *allItem = [[NSMutableArray alloc] init];
    for (int i=0; i<[infoDic count]; i++) {
        NSDictionary *contentOfDic = [infoDic objectForKey:[NSNumber numberWithInt:i]];
        NSString *name = [contentOfDic objectForKey:@"sender"];
        [allItem addObject:name];
    }

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

上一篇下一篇

猜你喜欢

热点阅读