【发布时间】:2015-06-13 11:58:52
【问题描述】:
作为对请求的响应,我得到 JSON:
{
"letters": {
"A": 0,
"B": 1,
"C": 2,
"D": 3,
"E": 4,
...
}
}
这是我获取此 JSON 的代码:
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
operation.responseSerializer = [AFJSONResponseSerializer serializer];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"%@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
// Handle error
}];
我想用这样的键(不是值)填充数组:
数组[0] = "A"
数组[1] = "B" ...?
【问题讨论】:
-
Going from JSON to NSArray 的可能重复项
-
@sobolevn 错误示例 ....
-
@benji 谷歌它哥们。你正在尝试做的事情的例子比世界上所有海滩上的沙粒还要多:p
-
我想,用什么代码来获取响应并不重要。
标签: ios objective-c json afnetworking afnetworking-2