NSDictionary中的NSDictionary

Tas*_*que 6 xcode key objective-c nsdictionary

好的,我有一个.plist文件,

我有一个NSDictionary *StoredAddresses,

里面StoredAddresses,是另一把NSDictionary

我知道我可以用,

if ([dictionaryOfAddresses objectForKey:@"StoredAddresses"])
Run Code Online (Sandbox Code Playgroud)

要访问顶级NSDictionaries,但如何在存储的地址内搜索密钥?

Chr*_*ber 12

好吧,如果我读得正确,你就会在字典中找到字典.这与任何其他对象一样:

NSDictionary* Address=[dictionaryOfAddresses objectForKey:@"Home Address"];
NSString* Street=[Address objectForKey:@"Street"];
Run Code Online (Sandbox Code Playgroud)

如果您愿意,可以组合调用:

NSString* Street=[[dictionaryOfAddresses objectForKey:@"Home Address"] objectForKey:@"Street"];
Run Code Online (Sandbox Code Playgroud)