我有这样的 Json 响应。
{
"ss": 1,
"tc": 75,
"pn": "1",
"users": [
{
"id": "123456",
"ne": "John Smith",
"el": "example@example.com"
},
{
"id": "3213243",
"ne": "iPhone Guy",
"el": "sdads@dsss.com"
}
]
}
代码:
[manager loadObjectsAtResourcePath:@"path/to/resources" usingBlock:^(RKObjectLoader* loader) {
loader.method = RKRequestMethodPOST;
loader.params = inputDict;
loader.onDidLoadResponse = ^(RKResponse *response)
{
NSLog(@"Response is %@",response);// here it contains ss value
};
loader.onDidLoadObjectsDictionary = ^(NSDictionary *dictionary)
{
// NSLog(@"Dictionary is %@",dictionary);
};
loader.onDidFailWithError = ^(NSError *error)
{
NSLog(@"Restkit Error is %@",error);
};
loader.onDidLoadObjects = ^(NSArray * objects)
{
NSLog(@"Object Count is %d",[objects count]);
};
}];
从上面的响应中,我想检查成功(ss)是 0 还是 1。如果是 0,我不需要映射用户,否则我想映射用户。我怎样才能做到这一点。我是否需要映射 ss、tc 和 pn 或者是否可以检查 ss 值而无需映射。
任何帮助表示赞赏。