如何从NSDictionary获取键/值对? [英] How to get key/value pair from NSDictionary?
本文介绍了如何从NSDictionary获取键/值对?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我几乎不需要NSDictionary的帮助.我如何获得1对,如果我有字典,就说一个"id"的值
I need little help with NSDictionary. How can I get 1 pair, lets say a value for "id" if I have dictionary
NSDictionary *allCourses = [NSJSONSerialization JSONObjectWithData:allCoursesData options:NSJSONReadingMutableContainers error:&error];
它看起来像这样:
感谢您的帮助.
推荐答案
最短的方法:
NSNumber *number = allCourses[@"semacko"][@"id"];
这篇关于如何从NSDictionary获取键/值对?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文