使用afnetworking,请求参数json={}

首先需要导入jsonkit第三方包 

 AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];

    NSDictionary *parameter = [NSDictionary dictionaryWithObjectsAndKeys:@"13817676763",@"UPHONE",@"123",@"UFPWD",@"0000",@"AUTHCODE",nil];

    

    

    NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys:[parameter JSONString],@"json",nil];

    //    NSMutableArray *array = [[NSMutableArray alloc] initWithObjects:[NSNumber numberWithInt:1],@"pagecount",[NSNumber numberWithInt:10],@"pagesize",[NSNumber numberWithInt:100],@"sumcount", nil];

    

//    NSMutableArray *array = [[NSMutableArray alloc] initWithObjects:parameter,@"json", nil];


    

    [manager POST:@"http://121.42.40.105:8888/register.ashx" parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) {

        NSLog(@"JSON====: %@", responseObject);

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

        NSLog(@"Error====: %@", error.description);

        NSLog(@"返回值:",operation.responseString);

    }];

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。