- (void)sendPostRequest{
NSURLSession *session = [NSURLSession sharedSession];
NSString *urlStr = [NSString stringWithFormat:@"%@AppWebService.asmx/IOS_InsertTrip",urlHead];
NSURL *url = [NSURL URLWithString:urlStr];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
request.HTTPMethod =@"POST";
NSString *strhttpBody = [NSString stringWithFormat:kInsertTrip,
delegate.SellerCode,
_dataArray[1],
_dataArray[0],
_dataArray[2],
[NSStringstringWithFormat:@"%lf",_longtitede],
[NSStringstringWithFormat:@"%lf",_latitude]
,_dataArray[4],
mp3str1,
_dataArray[3]];
// NSLog(@"strhttpBody:%@",strhttpBody);
request.HTTPBody = [strhttpBody dataUsingEncoding:NSUTF8StringEncoding];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request completionHandler:^(NSData *_Nullable data, NSURLResponse *_Nullable response, NSError * _Nullable error) {
NSLog(@"%@",response);
[self showResponseCode:response];
}];
[dataTask resume];
}
/* 输出http响应的状态码 */
- (void)showResponseCode:(NSURLResponse *)response {
NSHTTPURLResponse* httpResponse = (NSHTTPURLResponse*)response;
NSInteger responseStatusCode = [httpResponse statusCode];
if (responseStatusCode ==200) {
[MyUnitiltycreateMyAlert:selfandTitle:@"提交成功"];
}else{
[MyUnitiltycreateMyAlert:nilandTitle:@"提交失败"];
}