Ios iphonesdk+;如何在字典值数组中检索字典
我想检索KpiName键(KpiData是数组,KpiName是字典键)和我下面提到的数据结构Ios iphonesdk+;如何在字典值数组中检索字典,ios,nsmutablearray,nsmutabledictionary,Ios,Nsmutablearray,Nsmutabledictionary,我想检索KpiName键(KpiData是数组,KpiName是字典键)和我下面提到的数据结构 --Array of dictionaries inside array of dictinary ex..listOfProjectsArray--( { alertSeverity = 1; customerName = TPMG; endDate = "05-05-2013"; isProjectHide = 1;
--Array of dictionaries inside array of dictinary
ex..listOfProjectsArray--(
{
alertSeverity = 1;
customerName = TPMG;
endDate = "05-05-2013";
isProjectHide = 1;
kpiData = (
{
KpiName = "Change Request ";
kpiActual = 14;
kpiPlanned = "";
kpiUnit = "";
},
{
KpiName = "Aged Debit";
kpiActual = 24000;
kpiPlanned = "";
kpiUnit = EUR;
},
);
lastInvoiceDate = "05-04-2013";
nextBillingDate = "05-04-2013";
nextMilestoneDate = "10-04-2013";
nextReviewDate = "08-04-2013";
plannedCompletionDate = "04-05-2013";
projectID = 3000;
projectName = "Rain Harvesting";
projectSortType = "";
projectStatus = 1;
startDate = "01-01-2013";
},
我试过这个,但它返回空
NSString *kpiName = [[[[listOfProjectsArray objectAtIndex:indexPath.row] valueForKey:@"kpiData"] objectAtIndex:0]valueForKey:@"kpiName"];
NSLog(@"kpiname:%@", kpiName);
试试这个
NSString *kpiName =[[[[listOfProjectsArray objectAtIndex:indexPath.row] objectForKey:@"kpiData"]objectAtIndex:0]objectForKey:@"KpiName"];
我被提到的字典钥匙错了
NSString *kpiName = [[[[listOfProjectsArray objectAtIndex:indexPath.row] valueForKey:@"kpiData"] objectAtIndex:0]valueForKey:@"kpiName"];
NSLog(@"kpiname:%@", kpiName);
正确的是
KpiName
键,而不是KpiName
键区分大小写。请尝试KpiName而不是KpiName