在AFNetworking 2.0中传递Json字符串

时间:2014-09-05 17:38:40

标签: ios ios7 afnetworking-2

我想在AFNetworking中传递json字符串我正在使用下面的代码将数据解析到服务器。

我的JSON字符串:

{"Queries":[{"Field":"text_all","Value":"Class1","IsPhrase":false,"Near":0}],"Filter":[{"Key":"Test","Value":["Test","Test2"]}],"Paging":0,"Count":10}

代码:

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.requestSerializer = [AFJSONRequestSerializer serializer];
 manager.responseSerializer = [AFHTTPResponseSerializer serializer];
      manager.requestSerializer = [AFJSONRequestSerializer serializer];
        [manager POST:@“http://www.test.com” parameters:main_dict success:^(AFHTTPRequestOperation *operation, id responseObject)
         {

            NSLog(@"responseString: %@", json);

        }
             failure:^(AFHTTPRequestOperation *operation, NSError *error)
         {

         }];

0 个答案:

没有答案