-1

我有一本像下面这样的字典:

{
    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 字符串的情况下解决此问题。谁能帮我。

4

2 回答 2

1
NSMutableArray *Array=[m_MutDictAnswers objectForKey@"73"]

试试这个,然后检查你得到了什么。

于 2013-04-26T12:50:44.900 回答
0

我的事情是这个字典首先在数组中你得到数组可能在获取字典数组之后它的索引为 0

NSString *string=[[[myarray objectAtIndex:0]objectForKey:@"72"]objectForKey:@"language"];
于 2013-04-26T13:10:08.480 回答