IOS开发ASIFormDataRequest 发送请求

只用于发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];
}

 

posted on 2015-02-05 10:47  jdong  阅读(233)  评论(0编辑  收藏  举报

导航