AFNetworking and jSON

后端 未结 7 1185
臣服心动
臣服心动 2020-12-28 08:57

I am getting following the json response from a web-service api. I want to extract product data from the json. I also want to implement this using AFNetworking.



        
7条回答
  •  一整个雨季
    2020-12-28 09:30

    if you're using AFNetworking 3.0, AFJSONRequestOperation doesn't exist anymore, you have to use AFHTTPSessionManager :

    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    [manager GET:@"http://example.com/resources.json" parameters:nil progress:nil success:^(NSURLSessionTask *task, id responseObject) {
        NSLog(@"JSON: %@", responseObject);
    } failure:^(NSURLSessionTask *operation, NSError *error) {
        NSLog(@"Error: %@", error);
    }];
    

提交回复
热议问题