我正在从 Web 服务获取数据,我将其放入NSDictionary
,并通过使用valueForKey
方法,我将数据绑定到一个数组中,它有 17 个元素,但计数显示为 1,因为第一个数据有双引号。这是示例代码:
- (void)BarChartfetchedData:(NSData *)responseData {
NSError* error;
NSDictionary* json = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error];
BarChartDictionary = [json objectForKey:@"Report_DashboardDetailProfitBranchResult"];
NSArray * new = [[NSArray alloc]initWithObjects:[BarChartDictionary valueForKey:@"ProfitAmount"],nil];
NSLog(@"mypieclass.itemArray: %@ ",new);
NSLog(@"Total: %lu ",(unsigned long)[new count]);
NSLog(@"BarChartDictionary: %lu ",(unsigned long)[BarChartDictionary count]);
}
需要获得总数 17。如何做到这一点,任何建议都会有所帮助。