gpt4 book ai didi

ios - HTTP 状态 500 - 请求处理失败

转载 作者:行者123 更新时间:2023-11-29 02:35:59 25 4
gpt4 key购买 nike

我试图将字符串值发布到 Sql Server。像这样

NSString *post =[NSString stringWithFormat:@"?&name=%@&password=%@&pin=%@&email=%@&phone=%@&address=%@&city=%@&status=%@",
name, password ,pin ,email ,phone,address,city,status];
NSLog(@"post%@",post);
NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];

NSString *postLength = [NSString stringWithFormat:@"%d",[postData length]];

NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init] ;

[request setURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://202.65.154.108:8080/SaveDollar/rest/deals/add"]]];

NSLog(@"getData%@",request);

[request setHTTPMethod:@"POST"];

[request setValue:postLength forHTTPHeaderField:@"Content-Length"];

[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Current-Type"];

[request setHTTPBody:postData];

NSLog(@"getData%@",request);


con3 = [[NSURLConnection alloc]initWithRequest:request delegate:self];

if(con3)
{ webData3=[NSMutableData data];
NSLog(@"Connection successful");
NSLog(@"GOOD Day My data %@",webData3);
}
else
{
NSLog(@"connection could not be made");
}

我试过这样连接成功。

- (void)connectionDidFinishLoading:(NSURLConnection *)connection{
NSString *responseText = [[NSString alloc] initWithData:webData3 encoding: NSASCIIStringEncoding];
NSLog(@"Response: %@", responseText);}

但是得到这样的响应 HTTP Status 500 - Request processing failed;嵌套异常是 java.lang.NullPointerException

我不明白我的错误是什么所以请给我任何想法,请告诉我我的代码有什么问题。

感谢进阶。

最佳答案

5xx 服务器错误

HTTP 500 内部服务器错误

一般错误消息,在遇到意外情况且没有更具体的消息合适时给出。本文出处Wikipedia : - List of HTTP status codesw3.org Status codes

因此需要在服务器端进行检查。这不是你的问题。

关于ios - HTTP 状态 500 - 请求处理失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26359154/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com