【发布时间】:2011-12-13 00:47:46
【问题描述】:
我脑子里的一切都搞砸了。枚举、NSObject、自定义接口等等…… 我只需要在 Objective C 中声明数据类型来表示这个 JSON 集合:
{
"firstName": "John",
"lastName" : "Smith",
"age" : 25,
"address" :
{
"streetAddress": "21 2nd Street",
"city" : "New York",
"state" : "NY",
"postalCode" : "10021"
},
"phoneNumber":
[
{
"type" : "home",
"number": "212 555-1234"
},
{
"type" : "fax",
"number": "646 555-4567"
}
]
}
这是来自维基百科 JSON 文章的示例。所以我需要解释一下如何将所有这些数据放入集合中(或自定义类型或其他东西,我不知道)。
例如,我需要 1000 个“电话簿”集合实例来存储和更改关于 1000 人的信息。我需要知道我该怎么做。
【问题讨论】:
标签: objective-c ios xcode json cocoa-touch