我已经设置了一个 AFNetworking HTTP Client 子类并将 HTTP 操作注册为 AFJSONRequestOperation。并像这样设置默认标题:
[self setDefaultHeader:@"Content-Type" value:@"application/json"];
[self setDefaultHeader:@"Accept" value:@"text/html"];
然后我像这样调用 RESTful 服务器:
[[TheAPIClient sharedClient] getPath:domain parameters:nil success:^(AFHTTPRequestOperation *operation, id JSON) {
NSLog(@"%@", JSON);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"FAILED");
}];
但我得到的只是很多这样的数字:
<7b0d0a20 20224d65 6e755365 74223a20 7b0d0a20 20202022 4b617465 676f7269 53657422 3a205b0d 0a202020 2020207b 0d0a2020 20202020 20202245 6c656d65 6e745365 74223a20 5b0d0a20 20202020 20202020 207b0d0a 20202020 20202020 20202020 22496422 3a20312c 0d0a2020 20202020 20202020 2020224e 61766e22 3a202252 656a6520 636f636b 7461696c 222c0d0a 20202020 20202020 20202020 22426573 6b726976 656c7365 223a2022 52656a65 723f222c 0d0a2020 20202020 20202020 20202250 72697322 3a203134 392c0d0a 20202020 20202020 20202020 224b6174 65676f72 69536574 4964223a 20310d0a 20202020 20202020 20207d0d 0a202020 20202020 205d2c0d 0a202020 20202020 20224964 223a2031 2c0d0a20 20202020 20202022 4e61766e 223a2022 466f7272 6574222c 0d0a2020 20202020 20202245 6c656d65 6e745365 74496422 3a20312c 0d0a2020 20202020 2020224d 656e755f 4964223a >
我怎么解决这个问题?任何想法为什么会这样?:)