gpt4 book ai didi

ios - AFNetworking问题:serialization.response代码= -1011“请求失败:找不到(404)”

转载 作者:行者123 更新时间:2023-12-01 16:30:32 26 4
gpt4 key购买 nike

我目前正在使用Django Rest框架为后端API设置iOS应用。我收到的-1011,当我使用的网址明显存在时,请求未找到错误。

控制台输出:

Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: not found (404)" 
UserInfo={com.alamofire.serialization.response.error.response<NSHTTPURLResponse:0x12d797940>

{ URL: https://myurl.com/users/login/ }
{ status code: 404, headers {
Allow = "POST, OPTIONS";
Connection = "keep-alive";
"Content-Type" = "application/json";
Date = "Thu, 06 Aug 2015 04:12:34 GMT";
Server = "Apache/2.4.12 (Amazon) mod_wsgi/3.5 Python/2.7.9";
"Transfer-Encoding" = Identity;
Vary = "Accept,Cookie";
"X-Frame-Options" = SAMEORIGIN;
} },

NSErrorFailingURLKey=https://myurl.com/users/login/,
com.alamofire.serialization.response.error.data=<7b226d73 67223a22 536f7272 792c2079 6f757220 75736572 6e616d65 2c656d61 696c206f 72207061 7373776f 72642069 7320696e 636f7272 6563742e 227d>, NSLocalizedDescription=Request failed: not found (404)}
2015-08-06 00:12:35.070 Tumvi[10963:3903454] Failed To Login

我已经在chrome上使用Rest客户端扩展对端点进行了测试,正如我之前提到的,模拟器IOS8.4和另一个非ios9手机上完全相同的代码运行没有任何问题。

老实说,我似乎无法弄清楚可能是什么问题。感谢你的帮助!

最佳答案

希望对您有帮助。

manager.requestSerializer = [AFHTTPRequestSerializer serializer];
manager.responseSerializer = [AFHTTPResponseSerializer serializer]; //AFHTTPResponseSerializer serializer
manager.responseSerializer.acceptableContentTypes = [manager.responseSerializer.acceptableContentTypes setByAddingObject:@"text/html"];

关于ios - AFNetworking问题:serialization.response代码= -1011“请求失败:找不到(404)”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31846864/

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