gpt4 book ai didi

带有 AFNetworking 的 iOS POST : NSLocalizedDescription=Request failed: internal server error (500)

转载 作者:可可西里 更新时间:2023-11-01 05:00:29 24 4
gpt4 key购买 nike

我有一个 UITextField,当我在 UITextField 中写一些东西时,我想更新我的服务器,并且按更新按钮,我使用了 AFNetworking,但出现错误:

 Domain=com.alamofire.error.serialization.response Code=-1011 
"Request failed: internal server error (500)
{ status code: 500, headers {
"Access-Control-Allow-Headers" = "Origin, X-Requested-With, Content-Type, Accept";
"Access-Control-Allow-Methods" = "OPTIONS,GET,POST,PUT,DELETE";
"Access-Control-Allow-Origin" = "*";
Connection = "keep-alive";
"Content-Type" = "text/plain";
Date = "Thu, 24 Jul 2014 00:41:56 GMT";
Server = Cowboy;
"Transfer-Encoding" = Identity;
Via = "1.1 vegur";
"X-Powered-By" = Express;
} }, NSLocalizedDescription=Request failed: internal server error (500)}

这是我的更新按钮代码:

AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
manager.requestSerializer = [AFJSONRequestSerializer serializer];


NSDictionary *params = @ {@"status" :_status};


[manager POST:BASE_URL parameters:params
success:^(AFHTTPRequestOperation *operation, id responseObject)
{
NSLog(@"JSON: %@", responseObject);
}
failure:
^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"Error: %@", error);
}];

感谢任何帮助!

最佳答案

错误代码,-1011 表示 kCFURLErrorBadServerResponse(来自 docs)。您的 Web 服务 (API) 给您的响应是 AFNetworking 的请求/响应序列化程序不知道的。请您的开发团队查看并更正错误。

关于带有 AFNetworking 的 iOS POST : NSLocalizedDescription=Request failed: internal server error (500),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24923408/

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