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を取得する必要があります。その方法、提案は役に立ちます。