2013-04-16 82 views
0

我想以檢索KpiName鍵(KpiData裏面kpiName陣列是字典鍵)及以下iPhone的SDK +如何以檢索字典裏面字典的數組值

--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); 
+1

鍵區分大小寫。嘗試使用KpiName而不是kpiName – Hjalmar

回答

0

試試這個

NSString *kpiName =[[[[listOfProjectsArray objectAtIndex:indexPath.row] objectForKey:@"kpiData"]objectAtIndex:0]objectForKey:@"KpiName"]; 
0

我提到的錯誤解釋ķ安永

NSString *kpiName = [[[[listOfProjectsArray objectAtIndex:indexPath.row] valueForKey:@"kpiData"] objectAtIndex:0]valueForKey:@"kpiName"]; 
     NSLog(@"kpiname:%@", kpiName); 

正確的一項KpiName關鍵,而不是kpiName