【问题标题】:Unable to assign data to nsmutableDictionary or nsdictionary无法将数据分配给 nsmutableDictionary 或 nsdictionary
【发布时间】:2011-07-12 06:51:58
【问题描述】:

在下面的代码中,我只是分配了从 api 调用返回的字符串值。将字符串值分配给 .h 文件中已声明的第 3 行中的 loginResultArray。之后,当我将该数组移动到第 4 行的字典中时,字典值未存储。当我移动时,值不会存储在字典中。谁能回答我?

NSDictionary *resultDict=[[NSDictionary alloc]init];
SBJSON *parser = [[SBJSON alloc] init];
loginResultArray=(NSMutableArray*)[parser objectWithString:jsonValue];
NSMutableDictionary *dict=(NSMutableDictionary *)[loginResultArray objectAtIndex:0];

【问题讨论】:

    标签: objective-c json nsarray nsdictionary nsmutabledictionary


    【解决方案1】:

    保留loginResultArray的属性,合成后进行如下操作:

    self.loginResultArray=(NSMutableArray*)[parser objectWithString:jsonValue];
    

    【讨论】:

      猜你喜欢
      • 2016-03-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-17
      • 2015-07-31
      • 1970-01-01
      相关资源
      最近更新 更多