我想用对象和键创建一个 NSDictionary,如下例所示
NSArray *keys = [NSArray arrayWithObjects:@"key1", @"key2", nil];
NSArray *objects = [NSArray arrayWithObjects:@"value1", @"value2", nil];
NSDictionary *dictionary = [NSDictionary dictionaryWithObjects:objects
forKeys:keys];
但我需要添加多个寄存器,例如:
code=1
description=John
code=2
description=Paul
code=3
description=Peter
.
.
.
exactly what I need, an NSDictionary like a json structure:
{
"people": [
{ "code":"1" , "name":"John" },
{ "code":"2" , "name":"Smith" },
{ "code":"3" , "name":"Jones" }
]
}