如何将json字典作为参数afnetworking post传递

时间:2014-10-28 06:32:02

标签: json dictionary afnetworking

我搜索了许多链接,将json字典作为afnetworking中的参数发布。我已将字典转换为json格式字符串,遗憾的是afnetworking post允许nsdictionary值作为参数。在服务器端json格式字典只接受。我的代码如下,请建议我afnetworking中的任何方法。谢谢

        AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", nil];
    manager.requestSerializer = [AFJSONRequestSerializer serializer];
    manager.responseSerializer = [AFJSONResponseSerializer serializer];

    NSDictionary *params = @{@"email":txt_email.text,@"password":txt_password.text,@"platform":@"iphone"};

    NSString *str_url=[NSString stringWithFormat:@"%@do_signup",BaseURLlogin];

   [manager POST:str_url parameters: params success:^(AFHTTPRequestOperation *operation, id responseObject) {

0 个答案:

没有答案