首页 > 代码库 > 使用afnetworking,请求参数json={}
使用afnetworking,请求参数json={}
首先需要导入jsonkit第三方包
AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManagermanager];
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:parameterssuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"JSON====: %@", responseObject);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error====: %@", error.description);
NSLog(@"返回值:",operation.responseString);
}];
使用afnetworking,请求参数json={}