POST

    

   
    NSURL *url = [NSURL URLWithString:@"https://www.baidu.com"];

    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];

    request.HTTPMethod = @"POST";

  // 请求参数 NSString
*bodyStr = [NSString stringWithFormat:@"username=%@&password=%@", username, password]; request.HTTPBody = [bodyStr dataUsingEncoding:NSUTF8StringEncoding]; NSData *data =[NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
    NSError *error = nil;

    NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&error];

    NSLog(@"---------------%@", json);
如果你错过了一天,那么你就真的错过了一天……ues.hk
原文地址:https://www.cnblogs.com/myios/p/3520409.html