// 1.创建 POST 请求
NSString *str =@"网址";
str = [str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *url = [NSURLURLWithString:str];
NSMutableURLRequest *request = [NSMutableURLRequestrequestWithURL:url];
request.HTTPMethod =@"POST";
// 给 POST 请求指定 bodyData
NSString *bodyStr =@"附带的包";
// 将字符串转换为数据类型(NSData)
NSData *bodyData = [bodyStrdataUsingEncoding:NSUTF8StringEncoding];
// 把转好的请求给 httpbody
request.HTTPBody = bodyData;
[NSURLConnectionsendAsynchronousRequest:request queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response,NSData *data, NSError *connectionError) {
NSDictionary *dic = [NSJSONSerializationJSONObjectWithData:data options:NSJSONReadingMutableContainerserror:nil];
NSLog(@"%@",dic);
}];