2013-04-26 44 views
-1

得到一個數組我有一本字典象下面這樣:無法從的NSMutableDictionary

{ 
    76 =  (
       { 
      language = en; 
      optionid = 1; 
      response = ffgh; 
     } 
    ); 
    74 =  (
       { 
      language = en; 
      optionid = 1; 
      response = "Herbert S.B. Baraf, MD"; 
     } 
    ); 
    75 =  (
       { 
      language = en; 
      optionid = 1; 
      response = ffgh; 
     } 
    ); 
    73 =  (
       { 
      language = en; 
      optionid = 1; 
      response = Excellent; 
     } 
    ); 
} 

我沒有從我的字典使用下面的代碼拿到鑰匙值數組:

NSMutableArray *Array=[m_MutDictAnswers objectForKey:m_strRuleQuestion ]; 

儘管日誌數組是空和m_strRuleQuestion73。我不知道爲什麼我得到一個空數組。 在我的json字符串m_strRuleQuestion是「73」,但是當我編輯json到m_strRuleQuestion到73時,我得到了正確的數組。我需要解決這個問題,編輯json字符串。誰能幫我。

+1

這種事情是更容易在調試器斷點找出... PO [dict objectForKey @「72」] – 2013-04-26 12:14:54

+0

[dict objectForKey @「72」]也返回空數組 – krishna 2013-04-26 12:16:17

+1

然後嘗試@ 73,[dict allKeys] ...在調試器中,您不必重新編譯,你可以找出什麼真的在進行 – 2013-04-26 12:18:26

回答

1
NSMutableArray *Array=[m_MutDictAnswers [email protected]"73"] 

試試這個,然後檢查你得到了什麼。

0

我的事這本字典是數組首先你得陣列可它之後的0指數獲取字典陣列

NSString *string=[[[myarray objectAtIndex:0]objectForKey:@"72"]objectForKey:@"language"]; 
相關問題