NSDictionary 从一键到多键

NSDictionary frome one key to many

我得到了 NSDictionary

Printing description of gameDict:
{
    result =     {
        developer = "Bethesda Game Studios";
        genre = "Role-Playing";
        name = "The Elder Scrolls V: Skyrim";
        platform = "PlayStation 3";
        publisher = "Bethesda Softworks";
        rating = M;
        rlsdate = "2011-11-11";
        score = 92;
        summary = "The next chapter in the Elder Scrolls saga arrives from the Bethesda Game Studios. Skyrim reimagines the open-world fantasy epic, bringing to life a complete virtual world open for you to explore any way you choose. Play any type of character you can imagine, and do whatever you want; the legendary freedom of choice, storytelling, and adventure of The Elder Scrolls is realized like never before. Skyrim's new game engine brings to life a complete virtual world with rolling clouds, rugged mountains, bustling cities, lush fields, and ancient dungeons. Choose from hundreds of weapons, spells, and abilities. The new character system allows you to play any way you want and define yourself through your actions. Battle ancient dragons like you've never seen. As Dragonborn, learn their secrets and harness their power for yourself.";
        thumbnail = "http://static.metacritic.com/images/products/games/6/372529409ea6cc3faadf5674fd96ba2a-98.jpg";
        url = "http://www.metacritic.com/game/playstation-3/the-elder-scrolls-v-skyrim";
        userscore = "6.3";
    };
}

只有一把钥匙"result" 我怎样才能得到其他钥匙?

gameDict 是一个带有 key/pair 的 NSDictionary。键 "result" 指向另一个有更多键的 NSDictionary。因此,要访问任何更深的键,您可以内联进行:

NSNumber *score = gameDict[@"result"][@"score"];

或者你也可以把字典拿出来查询

NSDictionary *resultDict = gameDict[@"result"];
NSNumber *score = resultDict[@"score"];