只用于发post请求
#pragma mark - post请求 - (void)post { // 1.创建请求对象 NSURL *url = [NSURL URLWithString:@"http://192.168.1.200:8080/Server/login"]; ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url]; // 2.添加请求参数(请求体中的参数) [request setPostValue:@"123" forKey:@"username"]; [request setPostValue:@"999" forKey:@"pwd"]; [request setCompletionBlock:^{ NSLog(@"---请求完毕"); }]; // 3.发送请求 [request startAsynchronous]; }
时间: 2024-09-30 15:59:04